Accessing the value of a Preprocessor Macro definition

NSLog(@"%s", #FOO);

See Stringification. It's the technique you're already using. What was wrong with it?


What you are doing is the way to stringize (or stringify) macro values. The indirection is unavoidable.

This is mentioned in the GCC preprocessor manual section (archived link) that Rob linked to:

 #define xstr(s) str(s)
 #define str(s) #s
 #define foo 4
 str (foo)
      ==> "foo"
 xstr (foo)
      ==> xstr (4)
      ==> str (4)
      ==> "4