Reputation: 141
Is it possible to verify the type and number of arguments supplied to a variable length argument? (...)
?
Upvotes: 0
Views: 101
Reputation: 3684
At runtime? The type, no. The number, only if the caller places a NULL (or something recognisable) at the end, which is unreliable.
At compile time, you can get the compiler to check the arguments in the same way that it will check the args to printf. Google for gcc __attribute__ format
Upvotes: 1