A curriosity in the C compiler...

Bill Davidson billd at celerity.UUCP
Sat Oct 29 13:58:43 AEST 1988


In article <530 at uvicctr.UUCP> sbanner1 at uvicctr.UUCP (S. John Banner) writes:
>	This is a quick test of the C compiler, for implied bracketing...
>This will determine if the expression "a = b == c" is parsed
>as "(a = b) == c" (which is correct), or as "a = (b == c)" (which is not).

ACK!  Please refer to page 49 of K&R or any other C book which has a
precedence table.  "a = b == c" must be parsed as "a = (b == c)" by
laws of precedence which have been in C for a very long time.

A C programmer who does not know his precedence laws by heart had better
use a lot of parentheses or he can expect a LOT of problems.

	--Bill Davidson

These are my own opinions and FPS doesn't even know about them.
	....!ucsd!celerity!billd



More information about the Comp.lang.c mailing list