I want to execute a string literal and a char literal. Syntactically incorrect, "abc" 'd' "efg" displays a compiler error:
xc: 4: 24: error: expected ',' or ';' to 'd'
For now, I should use snprift (optional), even though the value of the string literal and char literal are known at compile time.
I tried
#define CONCAT(S,C) ({ \ static const char *_r = { (S), (C) }; \ _r; \ })
but this does not work because the null delimiter S not split. (Besides providing compiler warnings.)
Is there a way to write a macro to use
"abc" MACRO('d') "efg" orMACRO1(MACRO2("abc", 'd'), "efg") orMACRO("abc", 'd', "efg") ?
If someone asks why I want this: the char literal comes from the library, and I need to print the line as a status message.
c macros string char concatenation
kay
source share