break;
case TOKEN_VA_ARGS_ARRAY:
- if (out->constval.i >= varargs) {
+ if ((size_t)out->constval.i >= varargs) {
ftepp_error(ftepp, "subscript of `[%u]` is out of bounds for `__VA_ARGS__`", out->constval.i);
vec_free(old_string);
return false;
void print(...) = #1;
-#define NOPARENS(...) __VA_ARGS__
-#define callem(func, args) func NOPARENS(args)
+// method 0
+#define METHOD__(...) __VA_ARGS__
+#define METHOD_0(F,A) F METHOD__(A)
-#define callen(func, ...) func __VA_ARGS__##[0]
+// 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() {
- print(NOPARENS("hello ", "world\n"));
- callem(print, ("Yay", ", there\n"));
- callen(print, ("Woah",", there\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"));
}