This one bit me today

Sidney Markowitz sidney at saturn.ucsc.edu
Sun Oct 8 10:22:43 AEST 1989


We were talking about:
	#define xavg(m) (sum+3)/m
and then using the expression:
	xavg(*x)

Interestingly enough cc on this machine (ISI, running BSD 4.3) with
default settings chokes when the macro expands into the beginning of a
comment in (sum+3)/*x, but not when compiled with the -ansi switch.
Doesn't pAns say that comments are converted to whitespace before
macro expansion, so the /* generated by the macro should never be
parsed as a comment?
-- sidney markowitz <sidney at saturn.ucsc.edu)



More information about the Comp.lang.c mailing list