#define TO_CHAR( a ) 'a'
...
TO_CHAR(x) ==> 'x' // btw, this gives us 'a'... :-(
[c++] Macro charizing operator #@ w/o Microsoft's help?
Basically, I want this:
(http://msdn.microsoft.com/en-us/library/91tt6dfs(VS.80).aspx)
But in gcc.
Let me know of any hacky way to do it, I can't think of one.
That's pretty hacky. Not that the original task isn't hacky in itself :) Try
#define TO_CHAR(a) '##a##'
## is the token pasting operator.
#define TO_CHAR(a) '##a##'
## is the token pasting operator.
Quote:Original post by Zahlman
#define TO_CHAR(a) '##a##'
That ain't compiling. (Trivia: MS does have an alternate syntax for literals of the form 'abcd', which makes a word out of three or four characters... one of my tries looked something like your suggestion, with only four chars though instead of five, and compiled, but was, of course, incorrect.)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement