c++ - Gcc preprocessor and pasting -
# PLATFORM3 Define Pasteor (X, Y) X = ## _ ## y #define EVALUATOR (x, y) Pastor (X, Y) # Define platformspace (pretender) Evaluator (funny, platform) Zero platform without extere Specific (Ffunk) (four * x);
Compiled with GCC-A, the result is as follows:
# 1 "xx.c" # 1 "lt; & gt; # 1 "& lt; Command-Line & gt; "# 1" XX "Extra Zero Ffix (four * x);
However:
#define PLATFORM linux #define PASTER (x, y) x ## _ ## y #define EVALUATOR (x, y) Pastor (X, Y) # Define Platform-Specific Evaluator (Fun, Platform) Platform Specific (Affx) * X);
Results in:
# 1 "xx.c" # 1 "& lt; Built-in & gt; "# 1" & lt; Command-line & gt; "# 1" XXC "External Zero Safonicode (four * x);
What can I do to make this return 'somefunc_linux'? It seems, BTW.
If you want to use Linux as a name, then you Change your compiler options to define it:
GCC -Ulinux
Or standards:
GCC - Std = c90 -pedantic ... #or-std = c89 Received -ansi gcc -std = c99 -pedantic gcc -std = c11 -pedantic
See more discussion about why here:
Comments
Post a Comment