AND statements [message #14504] |
Sun, 28 February 1999 00:00  |
Phil Aldis
Messages: 11 Registered: February 1999
|
Junior Member |
|
|
Hi,
If you write some code like this:
test=Ptr_New()
IF Ptr_Valid(test) AND Size(*test, /type) NE 10 THEN print, *test
....can you always guarantee that it will not try to evaluate the second
statement if the first one was false - or is this a dangerous tactic to
adopt?
Oh, by the way, in a day or two I should be able to put out a little bit
of code which might be of interest to some. I did it at home so unlike
most of my programs I can let others use it. It will (hopefully) when
passed a pointer free up any heap memory, including, pointer arrays,
structures, objects. I suupose I could fairly simply extend it to object
references by simply using Obj_Class on the passed object reference,
then using Execute to create a structure and then it would be just like
normal. Although that addition might take a little while longer. If
anyone has any suggestions, please e-mail to let me know, (or if someone
else has done a program like this before).
Cheers,
Phil
P.S. If you reply, can you cc to philaldis@geocities.com, as well as to
the newsgroup, as my newsgroup feed seems to be more than a little
selective about the messages it picks up.
|
|
|
Re: AND statements [message #14532 is a reply to message #14504] |
Wed, 10 March 1999 00:00   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
rmlongfield@my-dejanews.com writes:
>
>
> Hi Jon, Please don't feel bad if you don't think people are using
> your programs. I've been hanging around this newsgroup for almost a year now
> and I've collected quite a lot of programs and web pages. Some I use, some
> not. I do use pointers frequently and even worse, pointers to pointers. When
> I've got a problem, I first search the Deja-News archives for this group for
> a solution. I may not use your program now but I did have a look at it and I
> know where it is for when and if I need it in the future.
>
> I do appreciate the sharing of tricks and ideas about how to
> handle certain problems.
> Rose
Here is what I have seen from my personal experience, based on my IDL
web page:
Number of IDL page hits per month - about 450
Number of program downloads per month - about 250
Number of feedback messages per month - about 1
So, to Phil: there may be a lot of people using your program but you
won't necessarily know about it. Feedback ratios seem to be less than
1%. Consider that: (a) only a fraction of people will download your
code; (b) a fraction of them will try to use it; (c) a fraction of
them will use it successfully; and (d) a fraction of them will then be
motivated to respond to the author.
Advertisement is also key. I see a noticeable increase in hits when I
mention my web page here on the newsgroup, based on informal polling.
To users of contributed software: feedback is always welcome! Whether
it's a bug report, a feature request, or a "thank you", I am sure that
the David's, Liam's, Phil's appreciate the interaction and knowing
that they don't live in a vacuum.
Craig
P.S. My IDL web page is http://astrog.physics.wisc.edu/~craigm/idl/idl.html
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: AND statements [message #14534 is a reply to message #14504] |
Wed, 10 March 1999 00:00   |
philaldis
Messages: 32 Registered: March 1999
|
Member |
|
|
On Wed, 10 Mar 1999 10:41:44 GMT, rmlongfield@my-dejanews.com wrote:
> Jon Kimber wrote:
Well, actually Phil Aldis wrote...but Phil Aldis also forgot to change
the signature file so that he was given the signature file that
someone else had been using.
>
> Hi Jon, Please don't feel bad if you don't think people are using
> your programs. I've been hanging around this newsgroup for almost a year now
> and I've collected quite a lot of programs and web pages. Some I use, some
> not. I do use pointers frequently and even worse, pointers to pointers. When
> I've got a problem, I first search the Deja-News archives for this group for
> a solution. I may not use your program now but I did have a look at it and I
> know where it is for when and if I need it in the future.
>
> I do appreciate the sharing of tricks and ideas about how to handle certain
> problems.
> Rose
Thank you, that makes me feel a bit better anyway. Maybe I feel
spurred on to tackle the general pupose structure editor now,
Cheers,
PHIL ALDIS
|
|
|
Re: AND statements [message #14535 is a reply to message #14504] |
Wed, 10 March 1999 00:00   |
rmlongfield
Messages: 68 Registered: August 1998
|
Member |
|
|
Jon Kimber wrote:
> I think that is certainly better than a goto in that circumstance. I
> had to use that several times in the ptr_free program I wrote (see
> post of 04/03/'99), but then no-one would know about that been as not
> one person has loooked at it - oh well I'll leave programs that are of
> use to others to the likes of DWF.
>
> Jon Kimber
> DERA
> ENGLAND
>
Hi Jon, Please don't feel bad if you don't think people are using
your programs. I've been hanging around this newsgroup for almost a year now
and I've collected quite a lot of programs and web pages. Some I use, some
not. I do use pointers frequently and even worse, pointers to pointers. When
I've got a problem, I first search the Deja-News archives for this group for
a solution. I may not use your program now but I did have a look at it and I
know where it is for when and if I need it in the future.
I do appreciate the sharing of tricks and ideas about how to handle certain
problems.
Rose
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
|
|
|
|
|
Re: AND statements [message #14571 is a reply to message #14504] |
Mon, 08 March 1999 00:00   |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Stein Vidar Hagfors Haugan wrote:
>
>
> True. The "problem" is when you want to write this up into
> a short and concise test with an ELSE part, you'll have to
> repeat the ELSE branch:
>
> IF NOT (A EQ 0) THEN IF B/A GT 5 THEN <SOMETHING> $
> ELSE <SOMETHING_ELSE> $
> ELSE <SOMETHING_ELSE>
>
> (Where the second SOMETHING_ELSE is the same as the first one)
>
> [...]
in short this is the same as
IF E1 THEN ( IF E2 THEN A ELSE B ) ELSE C
I don't think there are that many cases where B is really the same as C.
If so,
I find it often in error checking (is there a filename? is it empty?
etc.). In
these cases, it is often useful to "invert" the above to e.g.
IF NOT E1 THEN RETURN
IF E2 THEN A ELSE B
Shame on me(?), but sometimes I even think of and use GOTO statements in
similar
constructs. For skipping large convoluted IF THEN ELSE IF THEN ELSE
ENDIF IF ...
blocks, they are sometimes much more readable.
But it is true that I have often wished IDL had the abbreviated IF
clause. In my experience this is so common in modern computer languages
that it is rather dangerous *not* to have it available.
Regards,
Martin.
--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
|
|
|
|
Re: AND statements [message #14590 is a reply to message #14504] |
Fri, 12 March 1999 00:00  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Kirmanta de Malher <fernandez-j2@chu-caen.fr> writes:
>
> Craig Markwardt wrote:
>
>> To users of contributed software: feedback is always welcome! Whether
>> it's a bug report, a feature request, or a "thank you", I am sure that
>> the David's, Liam's, Phil's appreciate the interaction and knowing
>> that they don't live in a vacuum.
>>
>>
>
> Oh well Craig, i thank you again for your programs. Do you plan to compile your
> mpfit program in C ? I would want to have more speed :) Bye, Jesus
>
Hmmm. I translated the curve-fitting program MPFIT from the fortran
package called MINPACK. There is also a C version available (check
Netlib). As for interfacing IDL and C, that gets a little sticky.
Since I use MPFIT, I'll certainly keep trying to improve it as I can,
including speeding it up.
Craig
P.S. MPFIT is available from
http://astrog.physics.wisc.edu/~craigm/idl/idl.html
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: AND statements [message #14592 is a reply to message #14504] |
Fri, 12 March 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Kirmanta de Malher (fernandez-j2@chu-caen.fr) writes:
>> To users of contributed software: feedback is always welcome! Whether
>> it's a bug report, a feature request, or a "thank you", I am sure that
>> the David's, Liam's, Phil's appreciate the interaction and knowing
>> that they don't live in a vacuum.
>
> Oh well Craig, i thank you again for your programs. Do you plan to compile your
> mpfit program in C ? I would want to have more speed :)
Well, now. Here is why feedback is a double-edged sword. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: AND statements [message #14594 is a reply to message #14504] |
Fri, 12 March 1999 00:00  |
Kirmanta de Malher
Messages: 5 Registered: March 1998
|
Junior Member |
|
|
Craig Markwardt wrote:
> To users of contributed software: feedback is always welcome! Whether
> it's a bug report, a feature request, or a "thank you", I am sure that
> the David's, Liam's, Phil's appreciate the interaction and knowing
> that they don't live in a vacuum.
>
>
Oh well Craig, i thank you again for your programs. Do you plan to compile your
mpfit program in C ? I would want to have more speed :) Bye, Jesus
--
+--------------------------------------+
| |
| Jesus Fernandez |
| Unite IRM du CHU de Caen |
| Avenue de la cote de nacre |
| 14033 Caen |
| France |
| |
+--------------------------------------+
|
|
|