Patch #2 to Pcomm v1.1

Hans Buurman tnphhbu at dutrun.UUCP
Thu Sep 22 16:43:01 AEST 1988


In article <7782 at bcsaic.UUCP> paula at bcsaic.UUCP (Paul Allen) writes:
>I've now seen a couple postings about this bug, but nobody has got it
>right yet!  What has been missed is that C makes no guarantee about the
>order of expression evaluation.  The only safe way to perform this test
>is using two nested if statements.

In <The C Programming Language (2nd edition), p. 21>, Kernighan &
Ritchie write:
>Expressions connected by && or || are evaluated left to right, and it is
>guaranteed that evaluation will stop as soon as the truth or falsehood
>is known.
This is repeated on page 49, and on 207-208.

Hans Buurman
hans at duttnph.uucp or mcvax!dutrun!duttnph!hans
Disclaimer: any opinions expressed above are those of Allen, Kernighan &
Ritchie. (aren't they ?)



More information about the Comp.sources.bugs mailing list