comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: AND statements
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: AND statements [message #14499 is a reply to message #14494] Mon, 01 March 1999 00:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <36D9C642.99878C2A@geocities.com> Phil Aldis
<philaldis@geocities.com> writes:

> 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?

Nope. In fact, I can guarantee that it *will* evaluate the whole
logical expression. IDL is in this respect totally unlike C.

If the urge is big enough, one could ask RSI nicely to implement
operators like "AND THEN" and "OR ELSE" used like this:

IF ptr_valid(test) AND THEN size(*test,/type) ne 10 then print,*test

IF error_occurred OR ELSE check_for_error() then print,"Error"

"AND THEN" works like C &&
"OR ELSE" works like C ||, i.e. check_for_error() isn't called
if "error_occurred" is already true.

Operators with such names exist in e.g. Simula, IIRC.

I wouldn't be holding my breath, though.

Regards,

Stein Vidar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: image scaling with object graphics
Next Topic: TRANSREAD - read ASCII tables

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Mon Dec 01 01:13:35 PST 2025

Total time taken to generate the page: 0.88370 seconds