I read on a webpage (
http://wiki.kldp.org/wiki.php/CLanguageVariableArgumentsList
) that something like
#define debug(s, ...) fprintf(stderr, s, __VA_ARGS__)
void
foo(void)
{
debug("Entered the function, %%s\n", __func__);
/* ... */
}
is possible. However my VC6.0 compiler errors that he doesn't
understand ... in macro. Is it impossible? Or would there be other way
to do this?
I want to add header in my debug message for each module. Something
like,
#define App1DebugWrapper(s, ...) DebugOutput( "app1", s, __VA_ARGS__)
DebugOutput is an OutputDebugString wrapper, which makes a long string
starting "app1 :" and hand the string to OutputDebugString.
TIA.