When do you use "if ( a = b )"? (was Re: Funny mistake)

Byron Rakitzis byron at archone.tamu.edu
Mon Apr 1 15:33:51 AEST 1991


In article <13980 at helios.TAMU.EDU> byron at archone.tamu.edu (Byron Rakitzis) writes:
>In article <10655 at uwm.edu> markh at csd4.csd.uwm.edu (Mark William Hopkins) writes:
>>if ((A = f1()) != 2 || (A = f2()) != 3 || (A = f3()) != 4)
>	[etc.]
>Note that the above line does *not* read:

>	if (!(A = f1() - 2 && A = f2() - 3 && A = f3() - 4))

>which I consider to be in the Canonical Obfuscated Form.

In my anxiousness to convert the first statement to C.O.F., I erroneously
inverted the sense of the test. For the pedants on the net, the C.O.F.
of the first statement is of course

	if (A = f1() - 2 || A = f2() - 3 || A = f3() - 4)

Pardon my flatulence.



More information about the Comp.lang.c mailing list