]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Spiceing up the __VA_ARGS__ test
authorDale Weiler <killfieldengine@gmail.com>
Sun, 27 Jan 2013 13:05:01 +0000 (13:05 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sun, 27 Jan 2013 13:05:01 +0000 (13:05 +0000)
tests/pp_va_args.qc

index 6e4002cf4315ca5384a1785ca908644e606038d4..89a98c864b1a17166b48b41f8c4cc9684c788c06 100644 (file)
@@ -13,9 +13,12 @@ void print(...) = #1;
 // method 3
 #define METHOD_3(F,...) F __VA_ARGS__
 
+// selector
+#define METHOD(I, F, ...) METHOD_##I (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"));
+    METHOD(0, print, ("Method", " <zero>\n"));
+    METHOD(1, print, ("Method", " <one>\n"));
+    METHOD(2, print, ("Method", " <two>\n"));
+    METHOD(3, print, ("Method", " <three>\n"));
 }