F
Felix Kater
Hi,
I would like to write a variadic function f(const int MY_TYPE_X, ...) were MY_TYPE_X is not the amount of arguments but an index representing both: the amount of args and their type.
So, for each MY_TYPE_X, it should be allowed to call f only as if it were either f1, f2 or f3:
void f1(MY_TYPE_0, int){ /* ... */ }
void f2(MY_TYPE_1, int, void*, char*){ /* ... */ }
void f3(MY_TYPE_2, long, long){ /* ... */}
My question: Can I make the compiler produce warnings like with printf called incorrectly? E.g., this should produce a warning:
f(MY_TYPE_0, "a string", 99);
Felix
I would like to write a variadic function f(const int MY_TYPE_X, ...) were MY_TYPE_X is not the amount of arguments but an index representing both: the amount of args and their type.
So, for each MY_TYPE_X, it should be allowed to call f only as if it were either f1, f2 or f3:
void f1(MY_TYPE_0, int){ /* ... */ }
void f2(MY_TYPE_1, int, void*, char*){ /* ... */ }
void f3(MY_TYPE_2, long, long){ /* ... */}
My question: Can I make the compiler produce warnings like with printf called incorrectly? E.g., this should produce a warning:
f(MY_TYPE_0, "a string", 99);
Felix