System V preprocessor problem with <generic.h>

guy at sun.UUCP guy at sun.UUCP
Tue Apr 29 12:11:05 AEST 1986


> Try this fix for system V cpp:
> 
> 	#define name2(a,b)	a/**/b
> 	#define name3(a,b,c)	a/**/b/**/c
> 
> This works because the system V cpp strips the comments from the input.

So do earlier versions of Reiser's "cpp"; this is the "canonical" way of
concatenating two arguments to a macro, and is heavily used in 4BSD.  It
has, however, two problems:

	1) If you run your code through "lint", it won't work - "cpp"
	   is run by "lint" with the "-C" flag, which tells it not to
	   strip comments (for obvious reasons).

	2) It is not a guaranteed property of the C language, but a
	   quirk of the implementation, so it will not work in
	   general.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.arpa



More information about the Comp.lang.c mailing list