The GNU C Preprocessor


Page that contains the very useful Stringification documentation:

If you want to stringify the result of expansion of a macro argument, you have to use two levels of macros.

#define xstr(s) str(s)
#define str(s) #s
#define foo 4
str (foo)

expands to “foo”

xstr (foo)

expands to xstr (4)
expands to str (4)
expands to “4”

weblog/2010/05_16_174054.txt · Last modified: 16.05.2010 17:42 by rgareus