Path: utzoo!attcan!uunet!mcvax!hp4nl!dutrun!tnphhbu From: tnphhbu@dutrun.UUCP (Hans Buurman) Newsgroups: comp.sources.bugs Subject: Re: Patch #2 to Pcomm v1.1 Message-ID: <489@dutrun.UUCP> Date: 22 Sep 88 06:43:01 GMT References: <13900004@osiris.cso.uiuc.edu> <416@quintus.UUCP> <7782@bcsaic.UUCP> Reply-To: tnphhbu@dutrun.UUCP (J.Buurman) Organization: Delft University of Technology, The Netherlands Lines: 17 In article <7782@bcsaic.UUCP> paula@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, 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@duttnph.uucp or mcvax!dutrun!duttnph!hans Disclaimer: any opinions expressed above are those of Allen, Kernighan & Ritchie. (aren't they ?)