I have the following function:
void doStuff(int unusedParameter, ...)
{
va_list params;
va_start(params, unusedParameter);
/* ... */
va_end(p
In GCC, you have a workaround: You can define a macro with a variable number of arguments and then add the dummy parameter in the expansion:
#define doStuff(...) realDoStuff(0, __VA_ARGS__)
Your choice is either leave it as it is and use va_list
, alias it (if it's GCC) as others pointed out, or do something along the lines of exec(2)
interface - passing an array of pointers requiring a NULL
terminator:
/* \param args NULL-terminated array of
* pointers to arguments.
*/
void doStuff( void* args[] );
Either way it would be much better to refactor the interface to somehow take advantage of the type system - maybe overload on exact argument types used:
void doStuff( int );
void doStuff( const std::string& );
void doStuff( const MyFancyAppClass& );
Hope this helps.