Re: what does "_/**/X" means?

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Wed, 16 Dec 1998 16:46:41 +0000


On Tue, Dec 16, 1997 at 07:09:20AM +0000, gengsheng lin wrote:
> what does it means in file /usr/src/linux/include/linux/linkage.h for
> all things like #X,X##,X/**/,"_"#X,_##X,_##X##,_/**/X,_/**/X/**/ ?

Look in the CPP info page that comes with GCC/EGCS, or any good book on
ANSI C. The CPP info is particularly good at explaining the subtle
points.

You will find that #arg in a macro body expands to "arg" (with arg
substituted), and arg1 ## arg2 expands to both substitutions joined
together with no space between them. These are called stringification
and concatenation. There are subtleties about when macros in the
argument strings are expanded, which is why some macros appear to do
nothing but call other macros -- to affect when expansion occurs.

"arg" and arg1/**/arg2 are old-style forms of the same thing. They
don't work with ANSI C, but the new forms don't work with K&R (old) C.
Hence `#ifdef __STDC__' to decide which to use -- that checks for ANSI
C. The rules about when expansion occur are different for these forms.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/