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

Home » Public Forums » archive » Re: A simple IF statement question
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: A simple IF statement question [message #42500] Mon, 14 February 2005 13:22 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
David Fanning wrote:
> David Fanning writes:
>> Here is an article you might want to read:
>>
>> http://www.dfanning.com/code_tips/bitwiselogical.html
>
> It has been pointed out to me that the article is a bit
> deficient in that it doesn't mention the LOGICAL_PREDICATE
> compiler option. If you set:
>
> COMPILE_OPT LOGICAL_PREDICATE
>
> Then 0 is FALSE and everything else is TRUE. That probably
> makes more sense to *everyone*! :-)

The article in question was written not longer before IDL 6.0 went into
beta and was intended to summarise some newsgroup explanations of IDL's
(very confusing) treatment of logical values. I suspect that the article
and/or the newsgroup explanations convinced RSI to clean things up. I've
been meaning to update the article for, oh, 2 years.

Setting COMPILE_OPT LOGICAL_PREDICATE *is* a good idea, I think (if you
have version 6.0 or greater). But there is a catch: the NOT operator can
no longer be used in logical expresssions. For example, 1 is always true
and "NOT 1" evaluates to "-2". this was false under the old rules but is
true when LOGICAL_PREDICATE is in effect. A logical not operator was
introduced in 6.0 and this always works, well, logically.


--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: strange things in CONTOUR
Next Topic: Re: Reading HDF5 Variable

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

Current Time: Sat Oct 11 08:03:49 PDT 2025

Total time taken to generate the page: 1.44291 seconds