aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/test.cff
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-06 18:10:56 +0200
committerlemon <lsof@mailbox.org>2022-08-06 18:10:56 +0200
commit09baa8201a5422b8fa3d9d96bbfe7ceb3e12736b (patch)
tree7db3c6804beef789ca13b0fc3e2ce6a575fcae07 /bootstrap/test.cff
parent0c6330ce7ee50c1fa241793588fa83a3c00bc3c1 (diff)
.#len operator
Diffstat (limited to 'bootstrap/test.cff')
-rw-r--r--bootstrap/test.cff5
1 files changed, 2 insertions, 3 deletions
diff --git a/bootstrap/test.cff b/bootstrap/test.cff
index be6cb95..95ee7bf 100644
--- a/bootstrap/test.cff
+++ b/bootstrap/test.cff
@@ -10,9 +10,8 @@ enum Color {
Red, Green, Blue
}
-defmacro arraylength(ary) [ (sizeof(ary)/sizeof(ary[0])) ]
defmacro each(i, x, arr, ...body) [
- for let i = 0; i < arraylength(arr); ++i {
+ for let i = 0; i < arr.#len; ++i {
let x = arr[i];
{ body }
}
@@ -60,7 +59,7 @@ extern fn main (argc int, argv **u8) int {
printf("mag = %g\n", (&x)->mag());
let is []int = { [4] = 1, 2, [1 - 1] = 3 };
- isort(is, arraylength(is));
+ isort(is, is.#len);
each(i, x, is,
printf("%d\n", x);
)