How can I check the results of preprocessing? For example, say I have the following code:
#define CONCATENATE(X, Y) X ## Y
#define STRING_1 First
#define STRING_2 Second
#define STRING_3 CONCATENATE(STRING_1, STRING_2)
Is there a way to make sure STRING_3
will be expanded to FirstSecond
later in the program?
Each compiler should provide a switch to keep the preprocessed code
-E
Keep preprocessed files
in the settings or /P
switchFor other compilers I bet you'll find a suitable switch in the documentation
I think the best thing to do is run the C++ file under g++ -E <file> -o <file>.out
and then check the result that way.
I assume you mean check it as in debug - obviously you can't check it at runtime as the preprocessor information won't exist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With