vararg1.ssa (547B)
1 export 2 function d $f(l %x, ...) { 3 @start 4 %vp =l alloc8 32 5 vastart %vp 6 %i =l vaarg %vp 7 %n =d vaarg %vp 8 ret %n 9 } 10 11 export 12 function w $g(l %fmt, ...) { 13 @start 14 %vp =l alloc8 32 15 vastart %vp 16 %r =w call $print(l %fmt, l %vp) 17 ret %r 18 } 19 20 # >>> driver 21 # #include <stdarg.h> 22 # #include <stdio.h> 23 # extern double f(int, ...); 24 # extern int g(char *, ...); 25 # int print(const char *fmt, va_list *ap) { 26 # return vprintf(fmt, *ap); 27 # } 28 # int main() { 29 # g("Hell%c %s %g!\n", 'o', "world", f(42, "x", 42.0)); 30 # } 31 # <<< 32 33 # >>> output 34 # Hello world 42! 35 # <<<