Thread Stringification: im Gnu C Präprozessor (12 answers)
Opened by betterworld at 2003-11-15 22:32

betterworld
 2003-11-15 23:13
#11568 #11568
User since
2003-08-21
2613 articles
ModeratorIn

user image
Jetzt habe ich die Loesung. Weiter unten in der Dokumentation stand:
Quote
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)
==> "foo"
xstr (foo)
==> xstr (4)
==> str (4)
==> "4"


Wenn ich nun also Deine Idee damit kopple, komme ich zu
Code: (dl )
1
2
3
4
5
#define ERROR_RECURSION(n) \
do { if (n) \
fprintf (stderr, "Too many recursions (" str(n) ")\n"); \
exit(0);} \
while (0)


Ist ja pervers

View full thread Stringification: im Gnu C Präprozessor