diff options
| author | 2022-08-30 10:41:16 +0200 | |
|---|---|---|
| committer | 2022-08-30 10:41:16 +0200 | |
| commit | dea68bafe81c40adf29e45630cfeceb97b91a630 (patch) | |
| tree | 687c50f8e1402ed30ee711d27647aad8251a015c /test/3.cff | |
| parent | e4163c18cdc3522f24e459cd6ddde60edb1605e2 (diff) | |
Makefile and such
Diffstat (limited to 'test/3.cff')
| -rw-r--r-- | test/3.cff | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/3.cff b/test/3.cff new file mode 100644 index 0000000..7103225 --- /dev/null +++ b/test/3.cff @@ -0,0 +1,19 @@ +import "libc.hff"; + +fn sum(res int, ...) int { + let ap va_list = {}; + ap->start(); + printf("%d ", res); + for ;; { + let n = ap->arg(int); + printf("+ %d ", n); + res += n; + if n == 0 { break; } + } + ap->end(); + return res; +} + +extern fn main(argc int, argv **u8) int { + printf("= %d\n", sum(1,2,3,42,-1,0)); +} |