I want to remove the comma characters inside __VA_ARGS__.
I have found a FOR_EACH implementation, which kind of solves it, but gives cluttered error messages when there is a mistake.
My problem has the following properties:
OUTER(INNER(A), INNER(B))
I want to keep the comma in the line above so that the auto-formatter can do its job.
But I want to get rid of it inside the macro, so my idea was this:
embed the comma inside a
static_assert("" COMMA_HERE "");
like this:
#define OP static_assert(""
#define CP "");
#define OUTER(...) OP __VA_ARGS__ CP
#define INNER(...) CP __VA_ARGS__ OP
This also works.
Now I want to pass __VA_ARGS__ to another macro.
This is where I am stuck. If I change OUTER to, for example:
#define OUTER(...) OP ID(__VA_ARGS__) CP
then the single brackets of OP and CP mess with the result.
How can this be corrected?
which kind of solves it, but gives cluttered error messages when there is a mistake.so use it, it is the solution.How can this be corrected?with a for each macro. You can get the error message dpwn to... I think like 4 "in expansion of" messages, still a lot. Preprocessor will just give cluttered error messages. Also, if this is a message, maybe just#__VA_ARGS__.