Calling cdecl Functions That Have Different Number of Arguments
- by KlaxSmashing
I have functions that I wish to call based on some input. Each function has different number of arguments. In other words,
if (strcmp(str, "funcA") == 0) funcA(a, b, c);
else if (strcmp(str, "funcB") == 0) funcB(d);
else if (strcmp(str, "funcC") == 0) funcC(f, g);
This is a bit bulky and hard to maintain. Ideally, these are variadic functions…