Hi Monalin,

Thanks so much for your help with this.

I've probably just embarrassed myself by revealing my ignorance to all, but I thought that the
statement ....

if ( (delayInSecs == 0) || (--delayInSecs == 0))
doSomething();


would 'doSomething()' if 'delayInsecs' was ALREADY set to 0, or if decrementing it caused it to reach zero. That PRESUMES left-to-right evaluation ordering.

What I had HOPED to prevent was having the compiler evaluate the right-hand condition first WHEN 'delayInSecs' IS ALREADY ZERO, thus causing 'delayInSecs' to go negative.

Because I read left-to-right, I automatically assume the compiler will operate in a similar fashion, but I wondered if there was a compiler requirement to do so. I seem to recall, For instance, that Ada GUARANTEES a left-to-right evaluation ordering, whereas (I'm told) FORTRAN did not.



Perhaps I can clarify the example ....

if ( (delayInSecs == 0) || (--delayInSecs == 0)) {
if (!Lisp)
do Something();
}


now again, at risk of embarrassing myself by exposing my ignorance, it seems possible that if 'delayinsecs' is 1 when the IF statement is encountered, it is decremented to zero, satisfying the condition, BUT if Lisp is true, we don't do something.

At the next second, if the compiler guarantees left-to-right evaluation, 'delayInSecs' will still be zero, list processing has been completed so Lisp is no longer true, and we go on to doSomething().

BUT, if there is no such left-to-right evaluation guarantee, then the compiler is free to evaluate the right-hand condition first, decrementing 'delayInSecs' to -1 or 2^32-1. Either way, it'll be awhile before we doSomething().


I dunno; it's very likely that I'm wrong (AGAIN!) but that's what I had in mind. Thank you so much for taking the time to help me.

Best wishes.

bill