Mercurial > hg > CbC > old > device
annotate test/scope.c @ 550:df60b120675d
*** empty log message ***
author | kono |
---|---|
date | Tue, 03 Jan 2006 22:23:26 +0900 |
parents | dbfd6e88e2c3 |
children | 293f827ccfb2 |
rev | line source |
---|---|
363 | 1 /* |
2 | |
3 gcc -g -std=gnu99 test/scope.c | |
4 | |
5 */ | |
6 | |
7 #include <stdio.h> | |
550 | 8 // #define INLINE inline |
9 #ifdef INLINE | |
10 #else | |
11 #define INLINE | |
12 #endif | |
363 | 13 |
550 | 14 |
15 INLINE | |
363 | 16 void |
17 f(int *i,void *label) | |
18 { | |
19 static int k = 3; | |
20 { | |
21 static int k = 3; | |
22 *i = k++; | |
23 } | |
24 k--; | |
550 | 25 printf("#0024:f %d\n",k); |
363 | 26 } |
27 | |
550 | 28 INLINE |
29 static int | |
30 main0() | |
363 | 31 { |
32 int i,k; | |
33 void *exit = &&exit0; | |
34 i = 3;k=10; | |
544 | 35 |
550 | 36 printf("#0035:%s,%s,%d\n", |
544 | 37 __FILE__, |
38 __FUNCTION__, | |
39 __LINE__ | |
40 ); | |
41 | |
42 | |
363 | 43 for(int k=0;k<10;k++) { |
44 int i; | |
45 i = 4; | |
46 if (({ | |
47 __label__ exit0; | |
48 int i; | |
49 f(&i,&&exit0); | |
50 if (i==5) | |
51 goto exit0; | |
550 | 52 printf("#0051:2nd inner %d %d %0x\n",i,k,&&exit1==exit); |
363 | 53 exit0: |
54 i; | |
55 })!=7) { | |
56 goto exit1; | |
57 } else | |
58 goto *exit; | |
450
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
427
diff
changeset
|
59 /* not reached */ |
eaf9e2746c83
parallel assign for simple expr. (too complex solution)
kono
parents:
427
diff
changeset
|
60 i = ({ int k=3; k; }); |
363 | 61 exit1: |
550 | 62 printf("#0061:inner %d %d %0x\n",i,k,&&exit1==exit); |
363 | 63 } |
64 k++; | |
65 exit0: | |
550 | 66 printf("#0065:outer %d %d %0x\n",i,k,&&exit0==exit); |
363 | 67 return 0; |
68 } | |
550 | 69 |
70 int | |
71 main() | |
72 { | |
73 main0(); | |
74 } |