__VA_ARGS__ is a variable-parameter macro that few people know about this macro, which is the new C99 specification, and currently appears to be supported only by GCC (VC6.0 compiler does not support it).
The implementation idea is that the last parameter in the argument list in the macro definition is an ellipsis (that is, three points). This way the predefined macro _ _va_args_ _ can be used in the replacement section, replacing the string represented by the ellipsis. Like what:
#define PR (...) printf (__va_args__)
int main ()
{
int wt=1,sp=2;
PR ("hello\n");
PR ("weight =%d, shipping =%d", WT,SP);
return 0;
}
Output Result:
Hello
Weight = 1, shipping = 2
Ellipses can only replace the most later macro parameters.
#define W (x,..., y) Error!
Transferred from: http://www.cnblogs.com/pengyingh/articles/2407265.html
Variable-parameter macros ... and __va_args__