R
Randy Kobes
I have a couple of macros:
#define QUOTE_ME_HELPER(foo) #foo
#define QUOTE_ME(foo) QUOTE_ME_HELPER(foo)
and was wanting to use them as, for example,
const char bar[] = QUOTE_ME("domain=example.com");
I'm having a problem with embedded quotes though, using
VC++ 6 (SP5). This
const char bar[] = QUOTE_ME("domain=\"example.com");
expands to
const char bar[] = "\"domain=\\\"example.com\"";
which is OK, but
const char bar[] = QUOTE_ME("domain=\"example.com\"");
expands to
const char bar[] = "\"domain=\\\"example.com\\"\"";
which leads to an illegal escape sequence error. Both
examples work OK with gcc.
Is the above expected to work with VC++ 6? If it
"should" work, yet doesn't, can anyone suggest a
workaround, hopefully at the level of a macro?
Thanks very much.
#define QUOTE_ME_HELPER(foo) #foo
#define QUOTE_ME(foo) QUOTE_ME_HELPER(foo)
and was wanting to use them as, for example,
const char bar[] = QUOTE_ME("domain=example.com");
I'm having a problem with embedded quotes though, using
VC++ 6 (SP5). This
const char bar[] = QUOTE_ME("domain=\"example.com");
expands to
const char bar[] = "\"domain=\\\"example.com\"";
which is OK, but
const char bar[] = QUOTE_ME("domain=\"example.com\"");
expands to
const char bar[] = "\"domain=\\\"example.com\\"\"";
which leads to an illegal escape sequence error. Both
examples work OK with gcc.
Is the above expected to work with VC++ 6? If it
"should" work, yet doesn't, can anyone suggest a
workaround, hopefully at the level of a macro?
Thanks very much.