warnings appearing during preprocessor string concatenation (##)
I have the following line in my code,
#define FEATURE(select) feature_structure. ## select ## .member
...
FEATURE(test);
and when I run it through the compiler (gcc 3.2.2 on Linux x86) I get the _warning_
file.c:111:32: warning: pasting "." and "test" does not give a valid
preprocessing token
file.c:111:32: warning: pasting "test" and "." does not give a valid
preprocessing token
If I look at the preprocessor output, (gcc's -E option) it produces what I'm hoping for, although I'd like to avoid the warning. Suggestions?
- Jamie
Reply to "gmane.linux.c-programming" or me directly.
Quoted 9 lines · Jamie Risk
I have the following line in my code,
#define FEATURE(select)
feature_structure. ## select ## .member
...
FEATURE(test);and when I run it through the compiler (gcc 3.2.2 on Linux x86) I get the _warning_
Quoted 7 lines
file.c:111:32: warning: pasting "." and "test" does not give a valid
preprocessing token
file.c:111:32: warning: pasting "test" and "." does not give a valid
preprocessing tokenIf I look at the preprocessor output, (gcc's -E option) it produces what I'm hoping for, although I'd like to avoid the warning. Suggestions?
Just remove the '##' operator. The preprocessor is right here, there is nothing to concatenate to a token in your example.
Robert
Signature · 2 lines
Robert Schiele Tel.: +49-621-181-2517 Dipl.-Wirtsch.informatiker mailto:[email protected]