Forming composite tokens using /**/

Martin Minow minow at decvax.UUCP
Thu May 3 12:12:21 AEST 1984


Doug Gwyn noted that the C preprocessor allows you to form
composite tokens by using a "null" comment in the macro
definition:

	#define token(a, b) a/**/b
	...
	... token(foo, bar) generates "foobar"

I think this is specific to the particular implementation of the
pre-processor and may not be transportable.  There have been
mumblings in the C standards documentation as to how #defines
and comments will work, but I wouldn't count on the above hack
surviving.

Flames to the net -- I'm not on the committee.

Martin Minow
decvax!minow



More information about the Comp.lang.c mailing list