Mercurial > hg > CbC > CbC_gcc
annotate CbC-examples/rectypeTest/typedef2.cbc @ 108:7ad14f446135
add CbC-example/rectypeTest/
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 14 Jun 2012 20:30:24 +0900 |
parents | |
children |
rev | line source |
---|---|
108
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 typedef __code (*csPtr)(__rectype); |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 //typedef __code (*csPtr)(__code(*p)()); |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 //typedef __code (csPtr)(__code(*p)()); // csPtr *p |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 #include <stdio.h> |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 __code cs_end(csPtr p) |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 { |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 printf("end\n"); |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 } |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 __code cs(csPtr p) |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 { |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 csPtr b; |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 goto p(b); |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 // goto p(3); // note: expected ‘void (*)()’ but argument is of type ‘int’ |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 } |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 int main() { |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 csPtr p; |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 p = cs_end; |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 goto cs(p); |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 return 0; |
7ad14f446135
add CbC-example/rectypeTest/
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 } |