&& evaluation order (Re: C style)

guido at boring.UUCP guido at boring.UUCP
Sat Nov 2 05:31:39 AEST 1985


In article <538 at ttrdc.UUCP> levy at ttrdc.UUCP (Daniel R. Levy) writes:
>The && operator
>doesn't GUARANTEE the chronological order of evaluation is going to be left
>to right, if you have a screwball compiler (though it most probably will be).

If your compiler doesn't evaluate && left-to-right (and stop after the first
zero result) it isn't implementing C.    Maybe you're confusing it with
Pascal's AND or C's single & operators, which have to evaluate both operands.
So the program fragment you commented on was perfectly legit in using &&.

	Guido van Rossum, CWI, Amsterdam (guido at mcvax.UUCP)



More information about the Comp.lang.c mailing list