Patch #2 to Pcomm v1.1

Kent Forschmiedt kent at happym.UUCP
Fri Sep 23 15:33:54 AEST 1988


In article <7782 at bcsaic.UUCP> paula at 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 at happym.UUCP, tikal!camco!happym!kent, Happy Man Corp. USA 206-282-9598



More information about the Comp.sources.bugs mailing list