- The materiality of the comments on the question -
It seems impossible. Alternatively, a string literal can be defined instead of the STRING2CHAR macro:
#define A "a" #define STRING2CHAR(s) (*(s)) write(fd, "x=" A "\n", 4); putchar(STRING2CHAR(A));
or
#define A a #define XSTR(s) #s #define SYM2CHAR(sym) (*XSTR(sym)) #define SYM2STRING(sym) XSTR(sym)
The expression *"a" not a compile-time constant (therefore, for example, it cannot be used as an initializer for an object with non-automatic storage duration, non-VLA array length, case label, or bit field width), although compilers should be able to evaluate it at compile time (checked with Gcc and Clang).
Offered by M Oehm and Matt McNabb .
mafso
source share