Mail Archives: djgpp/1997/08/09/20:39:25
On Thu, 07 Aug 1997 21:14:48 -0700, Erik Max Francis <max AT alcyone DOT com>
>Kenneth Loafman wrote:
>> Although not guaranteed, most C's stop evaluation once an ORing
>> returns true from one of its expressions. Another potential surprise.
>Where in the world do you get this? ANSI C guarantees short circuiting
>for both && and ||. Section 6.3.13:
As early as 1978 I knew that && was short circuiting, but I've run across a
couple of compilers that did not short circuit the || operation, i.e. A||B
could be evaluated in either order.
Now these may have been earlier compilers, non-ANSI and all that, but once
burned, I remember the problem that burned me and avoid it.
- Raw text -