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

Home » Public Forums » archive » Re: Bug in operator precedence
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: Bug in operator precedence [message #45172 is a reply to message #45171] Tue, 16 August 2005 15:20 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
m_schellens@hotmail.com wrote:
> According to the manual, operators
>
> ~ || &&
>
> have lower precedence than
>
> AND OR XOR
>
> Now I get:
> IDL> print, 1 && ~3 and 4
> 0
> IDL> print, 1 && (~3) and 4
> 0
> IDL> print, 1 && ~(3 and 4)
> 1
>
> I would consider this as a bug.

Yes, but I suggest that the best way to fix it is to change the manual.
I think "~" logical negation should have similar priority to "not"
(bitwise negation) and higher than any of the binary logical operators,
ie the "eq"s the "and"s and the "&&"s. Why do I think this? Well...

* Bitwise and logical negation are very similar conceptually
* Unary operators normally outrank binary ones
* Like many people, I don't bother to read the manual unless I
really need to, and I have code that relies on what IDL does,
not what the manual says it should do.


--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Install ENVI/IDL on cygwin
Next Topic: Re: Install ENVI/IDL on cygwin

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

Current Time: Wed Oct 08 15:59:14 PDT 2025

Total time taken to generate the page: 0.00455 seconds