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

Home » Public Forums » archive » bitwise operators in IDL?
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: bitwise operators in IDL? [message #25213 is a reply to message #25080] Wed, 23 May 2001 11:19 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
JD Smith <jdsmith@astro.cornell.edu> writes:
> Marc Schellens wrote:
>> To late for short circuitry.
>> Consider a case when the second function in the if case
>> has a side effect (e.g. modifying a global variable).
>> After once defining the language this way, to change it
>> would mean to introduce incopatibility.
>
> Not if you introduce another operator set all together for short
> circuiting. People will use them increasingly, and AND,OR will go back
> to being used primarily for their bitwise function, as they should be.
> Sort of like C has "&&" and "&". I can't think of good replacement
> names (I assume RSI won't allow the sensible && and ||). Ideas? (ANDS?
> ORS?).
>
> JD

I like the idea of short-circuiting logical operators as well. Some
time ago I proposed LAND and LOR (for Logical-AND and Logical-OR). Of
course what do you do about backwards compatibility? Namely people
who have written code with their own LAND or ANDS variables. Imagine
this :-)

if LAND LAND 1 then ...

What would it mean?

Also, short-circuiting operators are not well-defined for vector
operands. With vector operands it is possible in an
element-by-element comparison for one element to evaluate true, while
the other evaluates false. E.g.

if [1,1] LAND [0,1] then ...

So, both of these issues would at least have to be dealt with, and my
guess is that the RSI folks will decide not to deal with it. Still, I
think it's worth exploring.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: defining functions on-the-fly
Next Topic: more IDL falls asleep

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

Current Time: Fri Oct 10 07:27:19 PDT 2025

Total time taken to generate the page: 1.12300 seconds