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

Home » Public Forums » archive » logical_true vs nothing in an if statment
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: logical_true vs nothing in an if statment [message #85937 is a reply to message #85932] Thu, 19 September 2013 13:22 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
I work with an IDL programmer who uses LOGICAL_TRUE *everywhere* including statements like

if LOGICAL_TRUE(Keyword_set(flag)) then setflag,...

He said he has been burned too many times before on the definition of "truth", so he always uses LOGICAL_TRUE() even in cases where it is unnecessary, such as when the variable can only take on the values 0 and 1.

His code drives me crazy... --Wayne

On Wednesday, September 18, 2013 5:37:04 PM UTC-4, Paul van Delst wrote:
> On 09/18/13 16:22, Michael Galloy wrote:
>
>>
>
>> But, you can change this behavior in selected routines with the
>
>> logical_predicate compile option:
>
>>
>
>> IDL> for i = 0, 10 do if i then print, 'true' else print, 'false'
>
>> false
>
>> true
>
>> false
>
> ...etc...
>
>> IDL> compile_opt logical_predicate
>
>> IDL> for i = 0, 10 do if i then print, 'true' else print, 'false'
>
>> false
>
>> true
>
>> true
>
> ...etc...
>
>
>
> True (pun intended :o), and the OP should make sure the option is put in
>
> the procedure/function in question, not an IDL startup file!
>
>
>
> Also, what if someone writes code based on the false/true ping-pong
>
> behaviour, and then gives the code to someone else that DOES have the
>
> logical_predicate option set in a startup file?
>
>
>
> Would hilarity ensue?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: idl: turn string value into variable name part2
Next Topic: Reading large files with restore

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

Current Time: Sun Oct 12 04:50:44 PDT 2025

Total time taken to generate the page: 2.16169 seconds