In GNU documentation on variadic macros, an example is
#define debug(format, ...) fprintf (stderr, format, __VA_ARGS__)
...
In standard C, you are not allowed to leave the variable argument out entirely; but you are allowed to pass an empty argument. For example, this invocation is invalid in ISO C, because there is no comma after the string:
debug ("A message")
Also GNU gave a solution:
#define debug(format, ...) fprintf (stderr, format, ## __VA_ARGS__)
I wonder why not use the below definition
#define debug(...) fprintf (stderr, __VA_ARGS__)
so that it can be compliant with Standard C, as well as more concise and intuitive?
...
argument.debug
. With the explicitformat
, you know what's expected.