From dea68bafe81c40adf29e45630cfeceb97b91a630 Mon Sep 17 00:00:00 2001 From: lemon Date: Tue, 30 Aug 2022 10:41:16 +0200 Subject: Makefile and such --- test/3.cff | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/3.cff (limited to 'test') 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)); +} -- cgit v1.2.3