#define apos "
#define CONCAT(a,b,c) a ## b ## c
#define INDIR_CONCAT(a,b,c) CONCAT(a,b,c)
#define CONDITION INDIR_CONCAT(apos,This is a test,apos);
printf(CONDITION);
The thing that i'm trying to do is to make a define for " and use that define instead of using ".
This is a bad idea for several reasons, and I don't think it would work even if you could define something as "
#define CONDITION INDIR_CONCAT(apos,This is a test,apos)
Here, even if apos is defined as " (which is a quotation mark, not an apostrpohe, just fyi), CONDITION would expand to this:
INDIR_CONCAT(",This is a test,")
which would give you a different error since you're now only passing one parameter to INDIR_CONCAT instead of the required 3.
But the bigger issue here is that this is a wretched abuse of macros.
The C++ preprocessor works on C++ tokens. An unclosed quote character is not a valid token.
It may work if you run the preprocessor as a stand-alone program (rather than letting the compiler call it for you)
I know this way but the thing that i want isn't like this. Thanks anyway :), i'm going to mark the topic as solved. The last may help people who search for an answer.