summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-09-23 13:17:22 +0200
committerTyge Løvset <[email protected]>2022-09-23 13:17:22 +0200
commit2c83996f1ad7ac7176833d1ecb76f59120bf52cd (patch)
tree495527c129d630b67aed0d8528c70ef5aa418106 /examples
parent0ec40a5819a619b6b2777f24c555a8953e99ea9b (diff)
downloadSTC-modified-2c83996f1ad7ac7176833d1ecb76f59120bf52cd.tar.gz
STC-modified-2c83996f1ad7ac7176833d1ecb76f59120bf52cd.zip
Reverted c_forrange() macro with 3 or more args: swapped 1st and 2nd arg again.
Diffstat (limited to 'examples')
-rw-r--r--examples/list.c2
-rw-r--r--examples/prime.c2
-rw-r--r--examples/stack.c4
3 files changed, 4 insertions, 4 deletions
diff --git a/examples/list.c b/examples/list.c
index 1f21304f..e94a9f18 100644
--- a/examples/list.c
+++ b/examples/list.c
@@ -17,7 +17,7 @@ int main() {
stc64_t rng = stc64_new(1234);
stc64_uniformf_t dist = stc64_uniformf_new(100.0f, n);
int m = 0;
- c_forrange (int, i, n)
+ c_forrange (n)
clist_fx_push_back(&list, stc64_uniformf(&rng, &dist)), ++m;
double sum = 0.0;
printf("sumarize %d:\n", m);
diff --git a/examples/prime.c b/examples/prime.c
index 7af66f33..d2a95af5 100644
--- a/examples/prime.c
+++ b/examples/prime.c
@@ -39,7 +39,7 @@ int main(void)
puts("");
int k = 20;
- c_forrange (intptr_t, i, n-1, 1, -2) {
+ c_forrange (i, intptr_t, n-1, 1, -2) {
if (k == 0) break;
else if (cbits_test(&primes, i>>1)) printf("%" PRIdMAX "\n", i), k--;
}
diff --git a/examples/stack.c b/examples/stack.c
index 210f8023..580b6428 100644
--- a/examples/stack.c
+++ b/examples/stack.c
@@ -14,12 +14,12 @@ int main() {
c_auto (cstack_i, stack)
c_auto (cstack_c, chars)
{
- c_forrange (int, i, 101)
+ c_forrange (i, int, 101)
cstack_i_push(&stack, i*i);
printf("%d\n", *cstack_i_top(&stack));
- c_forrange (int, i, 90)
+ c_forrange (i, int, 90)
cstack_i_pop(&stack);
c_foreach (i, cstack_i, stack)