aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/test.cff
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/test.cff')
-rw-r--r--bootstrap/test.cff7
1 files changed, 4 insertions, 3 deletions
diff --git a/bootstrap/test.cff b/bootstrap/test.cff
index 7a6b7ce..be6cb95 100644
--- a/bootstrap/test.cff
+++ b/bootstrap/test.cff
@@ -10,8 +10,9 @@ enum Color {
Red, Green, Blue
}
+defmacro arraylength(ary) [ (sizeof(ary)/sizeof(ary[0])) ]
defmacro each(i, x, arr, ...body) [
- for let i = 0; i < sizeof(arr)/sizeof(arr[0]); ++i {
+ for let i = 0; i < arraylength(arr); ++i {
let x = arr[i];
{ body }
}
@@ -58,8 +59,8 @@ extern fn main (argc int, argv **u8) int {
x->zero();
printf("mag = %g\n", (&x)->mag());
- let is [10]int = { [4] = 1, 2, [1 - 1] = 3 };
- isort(is, 10);
+ let is []int = { [4] = 1, 2, [1 - 1] = 3 };
+ isort(is, arraylength(is));
each(i, x, is,
printf("%d\n", x);
)