gmqcc/tests/pp_va_args.qc
2013-01-27 13:03:02 +00:00

21 lines
461 B
C++

void print(...) = #1;
// method 0
#define METHOD__(...) __VA_ARGS__
#define METHOD_0(F,A) F METHOD__(A)
// method 1
#define METHOD_1(F,A) F(METHOD__ A)
// method 2
#define METHOD_2(F,...) F __VA_ARGS__##[0]
// method 3
#define METHOD_3(F,...) F __VA_ARGS__
void main() {
METHOD_0(print, ("Method", " <zero>\n"));
METHOD_1(print, ("Method", " <one>\n"));
METHOD_2(print, ("Method", " <two>\n"));
METHOD_3(print, ("Method", " <three>\n"));
}