I have a function:
SendMsg(int x, string y, ...) { /*some code*/ }
I have a macro:
FOO(X, STRING, ...) SendMsg(X, STRING "%s %d", ##__VA_ARGS__, "xyz", 123)
so I can have something like this:
FOO(1000, "Note that line %d containing %d words is invalid", 5, 10);
expanded to
SendMsg(1000, "Note that line %d containing %d words is invalid" "%s %d", 5, 10, "xyz", 123);
At times I have something like this:
FOO(1000, "String without variables");
which should be expanded as
SendMsg(1000, "String without variables" "%s %d", "xyz", 123)
The macro works fine so far.
But at times I have something like this:
FOO(1000);
which should be expanded as
SendMsg(1000, "%s "%d", "xyz", 123);
But this does not work. I get an error that "macro FOO requires 3 arguments, but only 1 given". Any ideas?