| 1 | // ANSI function definitions | 
|---|
| 2 |  | 
|---|
| 3 | void h(void) {} | 
|---|
| 4 |  | 
|---|
| 5 | int f ( | 
|---|
| 6 | int p1(void), | 
|---|
| 7 | int p2(int), | 
|---|
| 8 | int (p3(void)), | 
|---|
| 9 | int (p4(int)), | 
|---|
| 10 | void g(void) | 
|---|
| 11 | ) { | 
|---|
| 12 | (*g)(); | 
|---|
| 13 | g(); | 
|---|
| 14 | g = h; | 
|---|
| 15 | } | 
|---|
| 16 |  | 
|---|
| 17 | int f1() {} | 
|---|
| 18 | int (f2()) {} | 
|---|
| 19 | int (*f3())() {} | 
|---|
| 20 | int *((f4())) {} | 
|---|
| 21 | int ((*f5()))() {} | 
|---|
| 22 | int *f6() {} | 
|---|
| 23 | int *(f7)() {} | 
|---|
| 24 | int **f8() {} | 
|---|
| 25 | int * const *(f9)() {} | 
|---|
| 26 | int (*f10())[] {} | 
|---|
| 27 | int (*f11())[][3] {} | 
|---|
| 28 | int ((*f12())[])[3] {} | 
|---|
| 29 |  | 
|---|
| 30 | // "implicit int" type specifier (not ANSI) | 
|---|
| 31 |  | 
|---|
| 32 | fII1( int i ) {} | 
|---|
| 33 | const fII2( int i ) {} | 
|---|
| 34 | extern fII3( int i ) {} | 
|---|
| 35 | extern const fII4( int i ) {} | 
|---|
| 36 |  | 
|---|
| 37 | *fII5() {} | 
|---|
| 38 | const *fII6() {} | 
|---|
| 39 | const long *fII7() {} | 
|---|
| 40 | static const long *fII8() {} | 
|---|
| 41 | const static long *fII9() {} | 
|---|
| 42 |  | 
|---|
| 43 | // K&R function definitions | 
|---|
| 44 |  | 
|---|
| 45 | fO1( i ) int i; {} | 
|---|
| 46 | int fO2( i ) int i; {} | 
|---|
| 47 | const fO3( i ) int i; {} | 
|---|
| 48 | extern fO4( i ) int i; {} | 
|---|
| 49 | extern const fO5( i ) int i; {} | 
|---|
| 50 |  | 
|---|
| 51 | // Cforall extensions | 
|---|
| 52 | #if 1 | 
|---|
| 53 | [] f( ); | 
|---|
| 54 | [int] f( ); | 
|---|
| 55 | [] f(int); | 
|---|
| 56 | [int] f(int); | 
|---|
| 57 | [] f( ) {} | 
|---|
| 58 | [int] f( ) {} | 
|---|
| 59 | [] f(int) {} | 
|---|
| 60 | [int] f(int) {} | 
|---|
| 61 |  | 
|---|
| 62 | [int x] f( ); | 
|---|
| 63 | [] f(int x); | 
|---|
| 64 | [int x] f(int x); | 
|---|
| 65 | [int x] f( ) {} | 
|---|
| 66 | [] f(int x) {} | 
|---|
| 67 | [int x] f(int x) {} | 
|---|
| 68 |  | 
|---|
| 69 | [int, int x] f( ); | 
|---|
| 70 | [] f(int, int x); | 
|---|
| 71 | [int, int x] f(int, int x); | 
|---|
| 72 | [int, int x] f( ) {} | 
|---|
| 73 | [] f(int, int x) {} | 
|---|
| 74 | [int, int x] f(int, int x) {} | 
|---|
| 75 |  | 
|---|
| 76 | [int, int x, int] f( ); | 
|---|
| 77 | [] f(int, int x, int); | 
|---|
| 78 | [int, int x, int] f(int, int x, int); | 
|---|
| 79 | [int, int x, int] f( ) {} | 
|---|
| 80 | [] f(int, int x, int) {} | 
|---|
| 81 | [int, int x, int] f(int, int x, int) {} | 
|---|
| 82 |  | 
|---|
| 83 | [int, int x, * int y] f( ); | 
|---|
| 84 | [] f(int, int x, * int y); | 
|---|
| 85 | [int, int x, * int y] f(int, int x, * int y); | 
|---|
| 86 | [int, int x, * int y] f( ) {} | 
|---|
| 87 | [] f(int, int x, * int y) {} | 
|---|
| 88 | [int, int x, * int y] f(int, int x, * int y) {} | 
|---|
| 89 |  | 
|---|
| 90 | [ int ] f11( int ), f12;  // => int f11( int ), f12( int ); | 
|---|
| 91 |  | 
|---|
| 92 | [int] f( | 
|---|
| 93 | int ( int, int p ), | 
|---|
| 94 | [int](int) | 
|---|
| 95 | ) { | 
|---|
| 96 | int (*(*p)[][10])[][3]; | 
|---|
| 97 | * [][10] * [][3] int p; | 
|---|
| 98 | * [] * [int](int) p; | 
|---|
| 99 | } | 
|---|
| 100 |  | 
|---|
| 101 | static const int *g1() {} | 
|---|
| 102 | static [ const int ] g2() {} | 
|---|
| 103 | static inline [ const * int ] g3() {} | 
|---|
| 104 | static inline [ const [ * int, int ] ] g4() {} | 
|---|
| 105 | static [ const [ * int, const int ] ] g5() {} | 
|---|
| 106 | #endif | 
|---|
| 107 |  | 
|---|
| 108 | // unnamed parameter | 
|---|
| 109 |  | 
|---|
| 110 | int g( | 
|---|
| 111 | int (), | 
|---|
| 112 |  | 
|---|
| 113 | int *(), | 
|---|
| 114 | int **(), | 
|---|
| 115 | int * const *(), | 
|---|
| 116 | int * const * const (), | 
|---|
| 117 |  | 
|---|
| 118 | int ([]), | 
|---|
| 119 | int ([10]), | 
|---|
| 120 |  | 
|---|
| 121 | int *([]), | 
|---|
| 122 | int *([10]), | 
|---|
| 123 | int **([]), | 
|---|
| 124 | int **([10]), | 
|---|
| 125 | int * const *([]), | 
|---|
| 126 | int * const *([10]), | 
|---|
| 127 | int * const * const ([]), | 
|---|
| 128 | int * const * const ([10]) | 
|---|
| 129 | ); | 
|---|
| 130 |  | 
|---|
| 131 | int g( | 
|---|
| 132 | int (), | 
|---|
| 133 |  | 
|---|
| 134 | int *(), | 
|---|
| 135 | int **(), | 
|---|
| 136 | int * const *(), | 
|---|
| 137 | int * const * const (), | 
|---|
| 138 |  | 
|---|
| 139 | int ([]), | 
|---|
| 140 | int ([10]), | 
|---|
| 141 |  | 
|---|
| 142 | int *([]), | 
|---|
| 143 | int *([10]), | 
|---|
| 144 | int **([]), | 
|---|
| 145 | int **([10]), | 
|---|
| 146 | int * const *([]), | 
|---|
| 147 | int * const *([10]), | 
|---|
| 148 | int * const * const ([]), | 
|---|
| 149 | int * const * const ([10]) | 
|---|
| 150 | ) { | 
|---|
| 151 | } | 
|---|
| 152 |  | 
|---|
| 153 | typedef int T; | 
|---|
| 154 |  | 
|---|
| 155 | int g( T g(T), T T ) { | 
|---|
| 156 | g(T); | 
|---|
| 157 | T = 3; | 
|---|
| 158 | } | 
|---|
| 159 |  | 
|---|
| 160 | // errors | 
|---|
| 161 |  | 
|---|
| 162 | //int f()[] {} | 
|---|
| 163 | //int (f[])() {} | 
|---|
| 164 | //int f[]() {} | 
|---|
| 165 | //int ((*f15())())[] {} | 
|---|