f z wrote:
Hi ,
Anybody could help to explain the following code which is the example in C99 std!
/***********************************************************/
4 EXAMPLE In the following fragment:
#define hash_hash # ## #
#define mkstr(a) # a
#define in_between(a) mkstr(a)
#define join(c, d) in_between(c hash_hash d)
char p[] = join(x, y); // equivalent to
// char p[] = "x ## y";
The expansion produces, at various stages:
join(x, y)
in_between(x hash_hash y)
in_between(x ## y)
mkstr(x ## y)
"x ## y"
In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
this new token is not the ## operator.
/**********************************************************/
Where define this syntax "#define hash_hash # ## #" in std?
In this definiation of macro , the "hash_hash" are defined with "# ##
#",but I don't know what is the mean of the first and last sharp(#).
Re-read your preprocessor specification. This is the symbol '#'
concatenated ('##' preprocessor operator) with the symbol '#'. Which
results in the string '##' being output.
This is apparently being used to get '##' into a literal string via a macro.
--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
find / -user your -name base -print0 | xargs -0 chown us:cats -- Unknown