[51b7345] | 1 | // ANSI function definitions |
---|
| 2 | |
---|
| 3 | void h(void) {} |
---|
| 4 | |
---|
| 5 | int f ( |
---|
| 6 | int (void), |
---|
| 7 | int (int), |
---|
| 8 | int ((void)), |
---|
| 9 | int ((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 | |
---|
| 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 *f1() {} |
---|
| 102 | static [ const int ] f2() {} |
---|
| 103 | static inline [ const * int ] f3() {} |
---|
| 104 | static inline [ const [ * int, int ] ] f4() {} |
---|
| 105 | static [ const [ * int, const int ] ] f5() {} |
---|
| 106 | |
---|
| 107 | // unnamed parameter |
---|
| 108 | |
---|
| 109 | int f( |
---|
| 110 | int (), |
---|
| 111 | |
---|
| 112 | int *(), |
---|
| 113 | int **(), |
---|
| 114 | int * const *(), |
---|
| 115 | int * const * const (), |
---|
| 116 | |
---|
| 117 | int ([]), |
---|
| 118 | int ([10]), |
---|
| 119 | |
---|
| 120 | int *([]), |
---|
| 121 | int *([10]), |
---|
| 122 | int **([]), |
---|
| 123 | int **([10]), |
---|
| 124 | int * const *([]), |
---|
| 125 | int * const *([10]), |
---|
| 126 | int * const * const ([]), |
---|
| 127 | int * const * const ([10]) |
---|
| 128 | ); |
---|
| 129 | |
---|
| 130 | int f( |
---|
| 131 | int (), |
---|
| 132 | |
---|
| 133 | int *(), |
---|
| 134 | int **(), |
---|
| 135 | int * const *(), |
---|
| 136 | int * const * const (), |
---|
| 137 | |
---|
| 138 | int ([]), |
---|
| 139 | int ([10]), |
---|
| 140 | |
---|
| 141 | int *([]), |
---|
| 142 | int *([10]), |
---|
| 143 | int **([]), |
---|
| 144 | int **([10]), |
---|
| 145 | int * const *([]), |
---|
| 146 | int * const *([10]), |
---|
| 147 | int * const * const ([]), |
---|
| 148 | int * const * const ([10]) |
---|
| 149 | ) { |
---|
| 150 | } |
---|
| 151 | |
---|
| 152 | typedef int T; |
---|
| 153 | |
---|
| 154 | int f( T (T), T T ) { |
---|
| 155 | T (T); |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | // errors |
---|
| 159 | |
---|
| 160 | //int f()[] {} |
---|
| 161 | //int (f[])() {} |
---|
| 162 | //int f[]() {} |
---|
| 163 | //int ((*f15())())[] {} |
---|