Path: utzoo!attcan!uunet!pilchuck!ssc!happym!kent From: kent@happym.UUCP (Kent Forschmiedt) Newsgroups: comp.sources.bugs Subject: Re: Patch #2 to Pcomm v1.1 Message-ID: <540@happym.UUCP> Date: 23 Sep 88 05:33:54 GMT References: <13900004@osiris.cso.uiuc.edu> <416@quintus.UUCP> <7782@bcsaic.UUCP> Reply-To: kent@happym.UUCP (Kent Forschmiedt) Organization: Happy Man Corporation Lines: 35 In article <7782@bcsaic.UUCP> paula@bcsaic.UUCP (Paul Allen) writes: [ argument about whether: if (*lock_path != NULL && lock_path != NULL) { is correct... ] >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. > >I'll be quiet now. Please do. It doesn't bother me that most people do not know C, but I am dismayed that so many people seem so bent on displaying their ignorance. I am not just picking on you, Paul - lots of people have blown this one. I wish that anyone, before offering information as fact, would be sure that said information is factual. Compilers are not democratic; they do not care for the opinions of the unwashed masses. Appendix A, 7.11: "The && operator groups left-to-right. It returns 1 if both its operands are non-zero, 0 otherwise. Unlike &, && guarantees left-to-right evaluation; moreover the second operand is not evaluated if the first operand is 0. The operands need not have the same type, but each must have one of the fundamental types or be a pointer. The result is always int." -- Reproduced without permission from "The C Programming Language", Kernighan and Ritchie, 1978 -- kent@happym.UUCP, tikal!camco!happym!kent, Happy Man Corp. USA 206-282-9598