#defines with parameters

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Nov 27 21:33:12 AEST 1988


In article <14724 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>>In article <264 at aber-cs.UUCP> pcg at cs.aber.ac.uk (Piercarlo Grandi) writes:
>[much not worth quoting]
>(It is, however, true that casting to whichever type is desired will
>patch things up and eliminate any difference between the two methods.)

Which is another reason the difference between "value preserving" and
"unsigned preserving" rules isn't very important: anyone who cares
will be using explicit casts to be sure the proper conversions occur.

>In article <8982 at smoke.BRL.MIL> gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
>>[parentheses in macro def/ref:]  Henry was mistaken about this.
>While he did not use dpANS phrasing, he did get the details right.

He may have.  However, I think Grandi interpreted him as saying that
white space was allowed before the ( in the DEFINITION of a function-
like macro, and I was responding to that.

	#define foo (x) ((x)+1)
	foo(z)
produces after substitution:
	(x) ((x)+1)(z)
whereas
	#define foo(x) ((x)+1)
	foo (z)
produces
	((z)+1)

X3J11 isn't proposing to change the way this has always worked.



More information about the Comp.lang.c mailing list