Mercurial > hg > CbC > CbC_gcc
comparison CbC-examples/rectypeTest/struct.cbc @ 106:85047c4f1ca4
add CbC-examples/rectypeTest
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 13 Jun 2012 17:18:58 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
105:b3cfc7733d3f | 106:85047c4f1ca4 |
---|---|
1 struct aaa { | |
2 __rectype *child; | |
3 }; | |
4 __code test() { | |
5 struct aaa b; | |
6 } | |
7 | |
8 struct interface { | |
9 __code (*next)(struct interface); | |
10 }; | |
11 | |
12 | |
13 #include <stdio.h> | |
14 #include <stdlib.h> | |
15 __code csB() { | |
16 exit(0); | |
17 } | |
18 __code print(struct interface p) { | |
19 puts("hello"); | |
20 exit(0); | |
21 } | |
22 | |
23 __code csA(struct interface p) { | |
24 struct interface ds = { csB }; | |
25 goto p.next(ds); | |
26 // goto p.next(3); // error | |
27 } | |
28 | |
29 int main() { | |
30 struct interface ds = { print }; | |
31 goto csA(ds); | |
32 return 0; | |
33 } |