diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CbC-examples/rectypeTest/typedef2.cbc	Thu Jun 14 20:30:24 2012 +0900
@@ -0,0 +1,24 @@
+typedef __code (*csPtr)(__rectype);
+
+//typedef __code (*csPtr)(__code(*p)());
+//typedef __code (csPtr)(__code(*p)()); // csPtr *p
+
+#include <stdio.h>
+__code cs_end(csPtr p)
+{
+  printf("end\n");
+}
+
+__code cs(csPtr p)
+{
+  csPtr b;
+  goto p(b);
+  //  goto p(3); // note: expected ‘void (*)()’ but argument is of type ‘int’
+}
+
+int main() {
+  csPtr p;
+  p = cs_end;
+  goto cs(p);
+  return 0;
+}