[73abe95] | 1 | // |
---|
[cd218e8] | 2 | // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
[73abe95] | 6 | // |
---|
| 7 | // literals.c -- |
---|
| 8 | // |
---|
[cd218e8] | 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Sat Sep 9 16:34:38 2017 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[9428d52] | 12 | // Last Modified On : Sun Jul 1 15:12:15 2018 |
---|
| 13 | // Update Count : 137 |
---|
[73abe95] | 14 | // |
---|
[cd218e8] | 15 | |
---|
| 16 | #ifdef __CFA__ |
---|
[201aeb9] | 17 | #include <stdint.h> |
---|
[73abe95] | 18 | #include <fstream.hfa> |
---|
[cd218e8] | 19 | |
---|
| 20 | void f( char v ) { sout | "char " | v | endl; } |
---|
| 21 | void f( signed char v ) { sout | "signed char " | v | endl; } |
---|
| 22 | void f( unsigned char v ) { sout | "unsigned char " | v | endl; } |
---|
[beec62c] | 23 | void f( signed short v ) { sout | "signed short int" | v | endl; } |
---|
| 24 | void f( unsigned short v ) { sout | "unsigned short int" | v | endl; } |
---|
[cd218e8] | 25 | void f( size_t v ) { sout | "size_t" | v | endl; } |
---|
| 26 | #endif // __CFA__ |
---|
| 27 | |
---|
| 28 | //#define ERROR |
---|
| 29 | |
---|
[62edde5] | 30 | int main() { |
---|
[cd218e8] | 31 | // integer literals |
---|
| 32 | |
---|
[ea46db7] | 33 | // binary |
---|
| 34 | 0b01101011; 0b01101011u; 0b01101011l; 0b01101011ll; 0b01101011ul; 0b01101011lu; 0b01101011ull; 0b01101011llu; |
---|
| 35 | +0b01101011; +0b01101011u; +0b01101011l; +0b01101011ll; +0b01101011ul; +0b01101011lu; +0b01101011ull; +0b01101011llu; |
---|
| 36 | -0b01101011; -0b01101011u; -0b01101011l; -0b01101011ll; -0b01101011ul; -0b01101011lu; -0b01101011ull; -0b01101011llu; |
---|
| 37 | |
---|
[cd218e8] | 38 | // octal |
---|
| 39 | 01234567; 01234567u; 01234567l; 01234567ll; 01234567ul; 01234567lu; 01234567ull; 01234567llu; |
---|
| 40 | +01234567; +01234567u; +01234567l; +01234567ll; +01234567ul; +01234567lu; +01234567ull; +01234567llu; |
---|
| 41 | -01234567; -01234567u; -01234567l; -01234567ll; -01234567ul; -01234567lu; -01234567ull; -01234567llu; |
---|
| 42 | |
---|
| 43 | // decimal |
---|
| 44 | 1234567890; 1234567890u; 1234567890l; 1234567890ll; 1234567890ul; 1234567890lu; 1234567890ull; 1234567890llu; |
---|
| 45 | +1234567890; +1234567890u; +1234567890l; +1234567890ll; +1234567890ul; +1234567890lu; +1234567890ull; +1234567890llu; |
---|
| 46 | -1234567890; -1234567890u; -1234567890l; -1234567890ll; -1234567890ul; -1234567890lu; -1234567890ull; -1234567890llu; |
---|
| 47 | |
---|
| 48 | // hexadecimal |
---|
| 49 | 0x0123456789abcdef; 0x0123456789abcdefu; 0x0123456789abcdefl; 0x0123456789abcdefll; 0x0123456789abcdeful; 0x0123456789abcdeflu; 0x0123456789abcdefull; 0x0123456789abcdefllu; |
---|
| 50 | +0x0123456789abcdef; +0x0123456789abcdefu; +0x0123456789abcdefl; +0x0123456789abcdefll; +0x0123456789abcdeful; +0x0123456789abcdeflu; +0x0123456789abcdefull; +0x0123456789abcdefllu; |
---|
| 51 | -0x0123456789abcdef; -0x0123456789abcdefu; -0x0123456789abcdefl; -0x0123456789abcdefll; -0x0123456789abcdeful; -0x0123456789abcdeflu; -0x0123456789abcdefull; -0x0123456789abcdefllu; |
---|
| 52 | |
---|
| 53 | 0x0123456789ABCDEF; 0x0123456789ABCDEFu; 0x0123456789ABCDEFl; 0x0123456789ABCDEFll; 0x0123456789ABCDEFul; 0x0123456789ABCDEFlu; 0x0123456789ABCDEFull; 0x0123456789ABCDEFllu; |
---|
| 54 | +0x0123456789ABCDEF; +0x0123456789ABCDEFu; +0x0123456789ABCDEFl; +0x0123456789ABCDEFll; +0x0123456789ABCDEFul; +0x0123456789ABCDEFlu; +0x0123456789ABCDEFull; +0x0123456789ABCDEFllu; |
---|
| 55 | -0x0123456789ABCDEF; -0x0123456789ABCDEFu; -0x0123456789ABCDEFl; -0x0123456789ABCDEFll; -0x0123456789ABCDEFul; -0x0123456789ABCDEFlu; -0x0123456789ABCDEFull; -0x0123456789ABCDEFllu; |
---|
| 56 | |
---|
| 57 | 0X0123456789abcdef; 0X0123456789abcdefu; 0X0123456789abcdefl; 0X0123456789abcdefll; 0X0123456789abcdeful; 0X0123456789abcdeflu; 0X0123456789abcdefull; 0X0123456789abcdefllu; |
---|
| 58 | +0X0123456789abcdef; +0X0123456789abcdefu; +0X0123456789abcdefl; +0X0123456789abcdefll; +0X0123456789abcdeful; +0X0123456789abcdeflu; +0X0123456789abcdefull; +0X0123456789abcdefllu; |
---|
| 59 | -0X0123456789abcdef; -0X0123456789abcdefu; -0X0123456789abcdefl; -0X0123456789abcdefll; -0X0123456789abcdeful; -0X0123456789abcdeflu; -0X0123456789abcdefull; -0X0123456789abcdefllu; |
---|
| 60 | |
---|
| 61 | 0X0123456789ABCDEF; 0X0123456789ABCDEFu; 0X0123456789ABCDEFl; 0X0123456789ABCDEFll; 0X0123456789ABCDEFul; 0X0123456789ABCDEFlu; 0X0123456789ABCDEFull; 0X0123456789ABCDEFllu; |
---|
| 62 | +0X0123456789ABCDEF; +0X0123456789ABCDEFu; +0X0123456789ABCDEFl; +0X0123456789ABCDEFll; +0X0123456789ABCDEFul; +0X0123456789ABCDEFlu; +0X0123456789ABCDEFull; +0X0123456789ABCDEFllu; |
---|
| 63 | -0X0123456789ABCDEF; -0X0123456789ABCDEFu; -0X0123456789ABCDEFl; -0X0123456789ABCDEFll; -0X0123456789ABCDEFul; -0X0123456789ABCDEFlu; -0X0123456789ABCDEFull; -0X0123456789ABCDEFllu; |
---|
| 64 | |
---|
| 65 | // decimal floating literals |
---|
| 66 | |
---|
| 67 | 0123456789.; 0123456789.f; 0123456789.l; 0123456789.F; 0123456789.L; 0123456789.DL; |
---|
| 68 | +0123456789.; +0123456789.f; +0123456789.l; +0123456789.F; +0123456789.L; +0123456789.DL; |
---|
| 69 | -0123456789.; -0123456789.f; -0123456789.l; -0123456789.F; -0123456789.L; -0123456789.DL; |
---|
| 70 | |
---|
| 71 | 0123456789.e09; 0123456789.e09f; 0123456789.e09l; 0123456789.e09F; 0123456789.e09L; 0123456789.e09DL; |
---|
| 72 | +0123456789.e09; +0123456789.e09f; +0123456789.e09l; +0123456789.e09F; +0123456789.e09L; +0123456789.e09DL; |
---|
| 73 | -0123456789.e09; -0123456789.e09f; -0123456789.e09l; -0123456789.e09F; -0123456789.e09L; -0123456789.e09DL; |
---|
| 74 | |
---|
| 75 | 0123456789.e+09; 0123456789.e+09f; 0123456789.e+09l; 0123456789.e+09F; 0123456789.e+09L; 0123456789.e+09DL; |
---|
| 76 | +0123456789.e+09; +0123456789.e+09f; +0123456789.e+09l; +0123456789.e+09F; +0123456789.e+09L; +0123456789.e+09DL; |
---|
| 77 | -0123456789.e+09; -0123456789.e+09f; -0123456789.e+09l; -0123456789.e+09F; -0123456789.e+09L; -0123456789.e+09DL; |
---|
| 78 | |
---|
| 79 | 0123456789.e-09; 0123456789.e-09f; 0123456789.e-09l; 0123456789.e-09F; 0123456789.e-09L; 0123456789.e-09DL; |
---|
[201aeb9] | 80 | +0123456789.e-09; +0123456789.e-09f; +0123456789.e-09l; +0123456789.e-09F; +0123456789.e-09L; +0123456789.e-09DL; |
---|
[cd218e8] | 81 | -0123456789.e-09; -0123456789.e-09f; -0123456789.e-09l; -0123456789.e-09F; -0123456789.e-09L; -0123456789.e-09DL; |
---|
| 82 | |
---|
| 83 | .0123456789; .0123456789f; .0123456789l; .0123456789F; .0123456789L; .0123456789DL; |
---|
| 84 | +.0123456789; +.0123456789f; +.0123456789l; +.0123456789F; +.0123456789L; +.0123456789DL; |
---|
| 85 | -.0123456789; -.0123456789f; -.0123456789l; -.0123456789F; -.0123456789L; -.0123456789DL; |
---|
| 86 | |
---|
| 87 | .0123456789e09; .0123456789e09f; .0123456789e09l; .0123456789e09F; .0123456789e09L; .0123456789e09DL; |
---|
| 88 | +.0123456789e09; +.0123456789e09f; +.0123456789e09l; +.0123456789e09F; +.0123456789e09L; +.0123456789e09DL; |
---|
| 89 | -.0123456789e09; -.0123456789e09f; -.0123456789e09l; -.0123456789e09F; -.0123456789e09L; -.0123456789e09DL; |
---|
| 90 | |
---|
| 91 | .0123456789E+09; .0123456789E+09f; .0123456789E+09l; .0123456789E+09F; .0123456789E+09L; .0123456789E+09DL; |
---|
| 92 | +.0123456789E+09; +.0123456789E+09f; +.0123456789E+09l; +.0123456789E+09F; +.0123456789E+09L; +.0123456789E+09DL; |
---|
| 93 | -.0123456789E+09; -.0123456789E+09f; -.0123456789E+09l; -.0123456789E+09F; -.0123456789E+09L; -.0123456789E+09DL; |
---|
| 94 | |
---|
| 95 | .0123456789E-09; .0123456789E-09f; .0123456789E-09l; .0123456789E-09F; .0123456789E-09L; .0123456789E-09DL; |
---|
| 96 | -.0123456789E-09; -.0123456789E-09f; -.0123456789E-09l; -.0123456789E-09F; -.0123456789E-09L; -.0123456789E-09DL; |
---|
| 97 | -.0123456789E-09; -.0123456789E-09f; -.0123456789E-09l; -.0123456789E-09F; -.0123456789E-09L; -.0123456789E-09DL; |
---|
| 98 | |
---|
| 99 | 0123456789.0123456789; 0123456789.0123456789f; 0123456789.0123456789l; 0123456789.0123456789F; 0123456789.0123456789L; 0123456789.0123456789DL; |
---|
| 100 | +0123456789.0123456789; +0123456789.0123456789f; +0123456789.0123456789l; +0123456789.0123456789F; +0123456789.0123456789L; +0123456789.0123456789DL; |
---|
| 101 | -0123456789.0123456789; -0123456789.0123456789f; -0123456789.0123456789l; -0123456789.0123456789F; -0123456789.0123456789L; -0123456789.0123456789DL; |
---|
| 102 | |
---|
| 103 | 0123456789.0123456789E09; 0123456789.0123456789E09f; 0123456789.0123456789E09l; 0123456789.0123456789E09F; 0123456789.0123456789E09L; 0123456789.0123456789E09DL; |
---|
| 104 | +0123456789.0123456789E09; +0123456789.0123456789E09f; +0123456789.0123456789E09l; +0123456789.0123456789E09F; +0123456789.0123456789E09L; +0123456789.0123456789E09DL; |
---|
| 105 | -0123456789.0123456789E09; -0123456789.0123456789E09f; -0123456789.0123456789E09l; -0123456789.0123456789E09F; -0123456789.0123456789E09L; -0123456789.0123456789E09DL; |
---|
| 106 | |
---|
| 107 | 0123456789.0123456789E+09; 0123456789.0123456789E+09f; 0123456789.0123456789E+09l; 0123456789.0123456789E+09F; 0123456789.0123456789E+09L; 0123456789.0123456789E+09DL; |
---|
| 108 | +0123456789.0123456789E+09; +0123456789.0123456789E+09f; +0123456789.0123456789E+09l; +0123456789.0123456789E+09F; +0123456789.0123456789E+09L; +0123456789.0123456789E+09DL; |
---|
| 109 | -0123456789.0123456789E+09; -0123456789.0123456789E+09f; -0123456789.0123456789E+09l; -0123456789.0123456789E+09F; -0123456789.0123456789E+09L; -0123456789.0123456789E+09DL; |
---|
| 110 | |
---|
| 111 | 0123456789.0123456789E-09; 0123456789.0123456789E-09f; 0123456789.0123456789E-09l; 0123456789.0123456789E-09F; 0123456789.0123456789E-09L; 0123456789.0123456789E-09DL; |
---|
[201aeb9] | 112 | +0123456789.0123456789E-09; +0123456789.0123456789E-09f; +0123456789.0123456789E-09l; +0123456789.0123456789E-09F; +0123456789.0123456789E-09L; +0123456789.0123456789E-09DL; |
---|
[cd218e8] | 113 | -0123456789.0123456789E-09; -0123456789.0123456789E-09f; -0123456789.0123456789E-09l; -0123456789.0123456789E-09F; -0123456789.0123456789E-09L; -0123456789.0123456789E-09DL; |
---|
| 114 | |
---|
| 115 | // hexadecimal floating literals, must have exponent |
---|
| 116 | |
---|
| 117 | 0x0123456789.p09; 0x0123456789.p09f; 0x0123456789.p09l; 0x0123456789.p09F; 0x0123456789.p09L; |
---|
| 118 | +0x0123456789.p09; +0x0123456789.p09f; +0x0123456789.p09l; +0x0123456789.p09F; +0x0123456789.p09L; |
---|
| 119 | -0x0123456789.p09; -0x0123456789.p09f; -0x0123456789.p09l; -0x0123456789.p09F; -0x0123456789.p09L; |
---|
| 120 | |
---|
| 121 | 0x0123456789.p+09; 0x0123456789.p+09f; 0x0123456789.p+09l; 0x0123456789.p+09F; 0x0123456789.p+09L; |
---|
| 122 | +0x0123456789.p+09; +0x0123456789.p+09f; +0x0123456789.p+09l; +0x0123456789.p+09F; +0x0123456789.p+09L; |
---|
| 123 | -0x0123456789.p+09; -0x0123456789.p+09f; -0x0123456789.p+09l; -0x0123456789.p+09F; -0x0123456789.p+09L; |
---|
| 124 | |
---|
| 125 | 0x0123456789.p-09; 0x0123456789.p-09f; 0x0123456789.p-09l; 0x0123456789.p-09F; 0x0123456789.p-09L; |
---|
[201aeb9] | 126 | +0x0123456789.p-09; +0x0123456789.p-09f; +0x0123456789.p-09l; +0x0123456789.p-09F; +0x0123456789.p-09L; |
---|
[cd218e8] | 127 | -0x0123456789.p-09; -0x0123456789.p-09f; -0x0123456789.p-09l; -0x0123456789.p-09F; -0x0123456789.p-09L; |
---|
| 128 | |
---|
| 129 | 0x.0123456789p09; 0x.0123456789p09f; 0x.0123456789p09l; 0x.0123456789p09F; 0x.0123456789p09L; |
---|
| 130 | +0x.0123456789p09; +0x.0123456789p09f; +0x.0123456789p09l; +0x.0123456789p09F; +0x.0123456789p09L; |
---|
| 131 | -0x.0123456789p09; -0x.0123456789p09f; -0x.0123456789p09l; -0x.0123456789p09F; -0x.0123456789p09L; |
---|
| 132 | |
---|
| 133 | 0x.0123456789p+09; 0x.0123456789p+09f; 0x.0123456789p+09l; 0x.0123456789p+09F; 0x.0123456789p+09L; |
---|
| 134 | +0x.0123456789p+09; +0x.0123456789p+09f; +0x.0123456789p+09l; +0x.0123456789p+09F; +0x.0123456789p+09L; |
---|
| 135 | -0x.0123456789p+09; -0x.0123456789p+09f; -0x.0123456789p+09l; -0x.0123456789p+09F; -0x.0123456789p+09L; |
---|
| 136 | |
---|
| 137 | 0x.0123456789P-09; 0x.0123456789P-09f; 0x.0123456789P-09l; 0x.0123456789P-09F; 0x.0123456789P-09L; |
---|
[201aeb9] | 138 | +0x.0123456789P-09; +0x.0123456789P-09f; +0x.0123456789P-09l; +0x.0123456789P-09F; +0x.0123456789P-09L; |
---|
[cd218e8] | 139 | -0x.0123456789P-09; -0x.0123456789P-09f; -0x.0123456789P-09l; -0x.0123456789P-09F; -0x.0123456789P-09L; |
---|
| 140 | |
---|
| 141 | 0X0123456789.0123456789P09; 0X0123456789.0123456789P09f; 0X0123456789.0123456789P09l; 0X0123456789.0123456789P09F; 0X0123456789.0123456789P09L; |
---|
| 142 | +0X0123456789.0123456789P09; +0X0123456789.0123456789P09f; +0X0123456789.0123456789P09l; +0X0123456789.0123456789P09F; +0X0123456789.0123456789P09L; |
---|
| 143 | -0X0123456789.0123456789P09; -0X0123456789.0123456789P09f; -0X0123456789.0123456789P09l; -0X0123456789.0123456789P09F; -0X0123456789.0123456789P09L; |
---|
| 144 | |
---|
| 145 | 0X0123456789.0123456789P+09; 0X0123456789.0123456789P+09f; 0X0123456789.0123456789P+09l; 0X0123456789.0123456789P+09F; 0X0123456789.0123456789P+09L; |
---|
| 146 | +0X0123456789.0123456789P+09; +0X0123456789.0123456789P+09f; +0X0123456789.0123456789P+09l; +0X0123456789.0123456789P+09F; +0X0123456789.0123456789P+09L; |
---|
| 147 | -0X0123456789.0123456789P+09; -0X0123456789.0123456789P+09f; -0X0123456789.0123456789P+09l; -0X0123456789.0123456789P+09F; -0X0123456789.0123456789P+09L; |
---|
| 148 | |
---|
| 149 | 0X0123456789.0123456789P-09; 0X0123456789.0123456789P-09f; 0X0123456789.0123456789P-09l; 0X0123456789.0123456789P-09F; 0X0123456789.0123456789P-09L; |
---|
[201aeb9] | 150 | +0X0123456789.0123456789P-09; +0X0123456789.0123456789P-09f; +0X0123456789.0123456789P-09l; +0X0123456789.0123456789P-09F; +0X0123456789.0123456789P-09L; |
---|
[cd218e8] | 151 | -0X0123456789.0123456789P-09; -0X0123456789.0123456789P-09f; -0X0123456789.0123456789P-09l; -0X0123456789.0123456789P-09F; -0X0123456789.0123456789P-09L; |
---|
[201aeb9] | 152 | |
---|
| 153 | #ifdef __CFA__ |
---|
| 154 | // fixed-size length |
---|
| 155 | |
---|
[ea46db7] | 156 | // binary |
---|
[9428d52] | 157 | 0b01101011_l8; 0b01101011_l16; 0b01101011_l32; 0b01101011_l64; 0b01101011_l8u; 0b01101011_ul16; 0b01101011_l32u; 0b01101011_ul64; |
---|
| 158 | +0b01101011_l8; +0b01101011_l16; +0b01101011_l32; +0b01101011_l64; +0b01101011_l8u; +0b01101011_ul16; +0b01101011_l32u; +0b01101011_ul64; |
---|
| 159 | -0b01101011_l8; -0b01101011_l16; -0b01101011_l32; -0b01101011_l64; -0b01101011_l8u; -0b01101011_ul16; -0b01101011_l32u; -0b01101011_ul64; |
---|
| 160 | |
---|
| 161 | #ifdef __LP64__ // 64-bit processor |
---|
| 162 | 0b01101011_l128; 0b01101011_ul128; |
---|
| 163 | +0b01101011_l128; +0b01101011_ul128; |
---|
| 164 | -0b01101011_l128; -0b01101011_ul128; |
---|
| 165 | #endif // __LP64__ |
---|
[ea46db7] | 166 | |
---|
[201aeb9] | 167 | // octal |
---|
[9428d52] | 168 | 01234567_l8; 01234567_l16; 01234567_l32; 01234567_l64; 01234567_l8u; 01234567_ul16; 01234567_l32u; 01234567_ul64; |
---|
| 169 | +01234567_l8; +01234567_l16; +01234567_l32; +01234567_l64; +01234567_l8u; +01234567_ul16; +01234567_l32u; +01234567_ul64; |
---|
| 170 | -01234567_l8; -01234567_l16; -01234567_l32; -01234567_l64; -01234567_l8u; -01234567_ul16; -01234567_l32u; -01234567_ul64; |
---|
| 171 | |
---|
| 172 | #ifdef __LP64__ // 64-bit processor |
---|
| 173 | 01234567_l128; 01234567_ul128; |
---|
| 174 | +01234567_l128; +01234567_ul128; |
---|
| 175 | -01234567_l128; -01234567_ul128; |
---|
| 176 | #endif // __LP64__ |
---|
[201aeb9] | 177 | |
---|
| 178 | // decimal |
---|
[9428d52] | 179 | 1234567890L8; 1234567890L16; 1234567890l32; 1234567890l64; 1234567890UL8; 1234567890L16U; 1234567890Ul32; 1234567890l64u; |
---|
| 180 | +1234567890L8; +1234567890L16; +1234567890l32; +1234567890l64; +1234567890UL8; +1234567890L16U; +1234567890Ul32; +1234567890l64u; |
---|
| 181 | -1234567890L8; -1234567890L16; -1234567890l32; -1234567890l64; -1234567890UL8; -1234567890L16U; -1234567890Ul32; -1234567890l64u; |
---|
| 182 | |
---|
| 183 | #ifdef __LP64__ // 64-bit processor |
---|
| 184 | 1234567890l128; 1234567890l128u; |
---|
| 185 | +1234567890l128; +1234567890l128u; |
---|
| 186 | -1234567890l128; -1234567890l128u; |
---|
| 187 | #endif // __LP64__ |
---|
[201aeb9] | 188 | |
---|
| 189 | // hexadecimal |
---|
| 190 | 0x0123456789abcdef_l8; 0x0123456789abcdef_l16; 0x0123456789abcdefl32; 0x0123456789abcdefl64; 0x0123456789abcdef_ul8; 0x0123456789abcdef_l16u; 0x0123456789abcdeful32; 0x0123456789abcdefl64u; |
---|
| 191 | +0x0123456789abcdef_l8; +0x0123456789abcdef_l16; +0x0123456789abcdefl32; +0x0123456789abcdefl64; +0x0123456789abcdef_ul8; +0x0123456789abcdef_l16u; +0x0123456789abcdeful32; +0x0123456789abcdefl64u; |
---|
| 192 | -0x0123456789abcdef_l8; -0x0123456789abcdef_l16; -0x0123456789abcdefl32; -0x0123456789abcdefl64; -0x0123456789abcdef_ul8; -0x0123456789abcdef_l16u; -0x0123456789abcdeful32; -0x0123456789abcdefl64u; |
---|
| 193 | |
---|
| 194 | 0x0123456789ABCDEF_l8; 0x0123456789ABCDEF_l16; 0x0123456789ABCDEFl32; 0x0123456789ABCDEFl64; 0x0123456789ABCDEF_ul8; 0x0123456789ABCDEF_l16u; 0x0123456789ABCDEFul32; 0x0123456789ABCDEFl64u; |
---|
| 195 | +0x0123456789ABCDEF_l8; +0x0123456789ABCDEF_l16; +0x0123456789ABCDEFl32; +0x0123456789ABCDEFl64; +0x0123456789ABCDEF_ul8; +0x0123456789ABCDEF_l16u; +0x0123456789ABCDEFul32; +0x0123456789ABCDEFl64u; |
---|
| 196 | -0x0123456789ABCDEF_l8; -0x0123456789ABCDEF_l16; -0x0123456789ABCDEFl32; -0x0123456789ABCDEFl64; -0x0123456789ABCDEF_ul8; -0x0123456789ABCDEF_l16u; -0x0123456789ABCDEFul32; -0x0123456789ABCDEFl64u; |
---|
| 197 | |
---|
| 198 | 0X0123456789abcdef_l8; 0X0123456789abcdef_l16; 0X0123456789abcdefl32; 0X0123456789abcdefl64; 0X0123456789abcdef_ul8; 0X0123456789abcdef_l16u; 0X0123456789abcdeful32; 0X0123456789abcdefl64u; |
---|
| 199 | +0X0123456789abcdef_l8; +0X0123456789abcdef_l16; +0X0123456789abcdefl32; +0X0123456789abcdefl64; +0X0123456789abcdef_ul8; +0X0123456789abcdef_l16u; +0X0123456789abcdeful32; +0X0123456789abcdefl64u; |
---|
| 200 | -0X0123456789abcdef_l8; -0X0123456789abcdef_l16; -0X0123456789abcdefl32; -0X0123456789abcdefl64; -0X0123456789abcdef_ul8; -0X0123456789abcdef_l16u; -0X0123456789abcdeful32; -0X0123456789abcdefl64u; |
---|
| 201 | |
---|
| 202 | 0X0123456789ABCDEF_l8; 0X0123456789ABCDEF_l16; 0X0123456789ABCDEFl32; 0X0123456789ABCDEFl64; 0X0123456789ABCDEF_ul8; 0X0123456789ABCDEF_l16u; 0X0123456789ABCDEFul32; 0X0123456789ABCDEFl64u; |
---|
| 203 | +0X0123456789ABCDEF_l8; +0X0123456789ABCDEF_l16; +0X0123456789ABCDEFl32; +0X0123456789ABCDEFl64; +0X0123456789ABCDEF_ul8; +0X0123456789ABCDEF_l16u; +0X0123456789ABCDEFul32; +0X0123456789ABCDEFl64u; |
---|
| 204 | -0X0123456789ABCDEF_l8; -0X0123456789ABCDEF_l16; -0X0123456789ABCDEFl32; -0X0123456789ABCDEFl64; -0X0123456789ABCDEF_ul8; -0X0123456789ABCDEF_l16u; -0X0123456789ABCDEFul32; -0X0123456789ABCDEFl64u; |
---|
| 205 | |
---|
| 206 | // floating |
---|
| 207 | 0123456789.l32; 0123456789.l64; 0123456789.l80; 0123456789.l128; |
---|
| 208 | +0123456789.l32; +0123456789.l64; +0123456789.l80; +0123456789.l128; |
---|
| 209 | -0123456789.l32; -0123456789.l64; -0123456789.l80; -0123456789.l128; |
---|
| 210 | |
---|
| 211 | 0123456789.e09L32; 0123456789.e09L64; 0123456789.e09L80; 0123456789.e09L128; |
---|
| 212 | +0123456789.e+09L32; +0123456789.e+09L64; +0123456789.e+09L80; +0123456789.e+09L128; |
---|
| 213 | -0123456789.e-09L32; -0123456789.e-09L64; -0123456789.e-09L80; -0123456789.e-09L128; |
---|
| 214 | |
---|
| 215 | .0123456789e09L32; .0123456789e09L64; .0123456789e09L80; .0123456789e09L128; |
---|
| 216 | +.0123456789E+09L32; +.0123456789E+09L64; +.0123456789E+09L80; +.0123456789E+09L128; |
---|
| 217 | -.0123456789E-09L32; -.0123456789E-09L64; -.0123456789E-09L80; -.0123456789E-09L128; |
---|
| 218 | |
---|
| 219 | 0123456789.0123456789L32; 0123456789.0123456789L64; 0123456789.0123456789L80; 0123456789.0123456789L128; |
---|
| 220 | +0123456789.0123456789E09L32; +0123456789.0123456789E09L64; +0123456789.0123456789E09L80; +0123456789.0123456789E09L128; |
---|
| 221 | -0123456789.0123456789E+09L32; -0123456789.0123456789E+09L64; -0123456789.0123456789E+09L80; -0123456789.0123456789E+09L128; |
---|
| 222 | 0123456789.0123456789E-09L32; 0123456789.0123456789E-09L64; 0123456789.0123456789E-09L80; 0123456789.0123456789E-09L128; |
---|
[73abe95] | 223 | |
---|
[201aeb9] | 224 | 0x0123456789.p09l32; 0x0123456789.p09l64; 0x0123456789.p09l80; 0x0123456789.p09l128; |
---|
| 225 | +0x0123456789.p09l32; +0x0123456789.p09l64; +0x0123456789.p09l80; +0x0123456789.p09l128; |
---|
| 226 | -0x0123456789.p09l32; -0x0123456789.p09l64; -0x0123456789.p09l80; -0x0123456789.p09l128; |
---|
| 227 | |
---|
| 228 | 0x0123456789.p+09l32; 0x0123456789.p+09L64; 0x0123456789.p+09L80; 0x0123456789.p+09L128; |
---|
| 229 | +0x0123456789.p-09l32; +0x0123456789.p-09L64; +0x0123456789.p-09L80; +0x0123456789.p-09L128; |
---|
| 230 | -0x.0123456789p09l32; -0x.0123456789p09L64; -0x.0123456789p09L80; -0x.0123456789p09L128; |
---|
[62edde5] | 231 | |
---|
[beec62c] | 232 | // char, short, int suffix overloading |
---|
[62edde5] | 233 | |
---|
[cd218e8] | 234 | f( 'a' ); |
---|
| 235 | f( 20_hh ); |
---|
[beec62c] | 236 | f( 21_hhu ); |
---|
| 237 | f( 22_h ); |
---|
| 238 | f( 23_uh ); |
---|
| 239 | f( 24z ); |
---|
[cd218e8] | 240 | #endif // __CFA__ |
---|
[62edde5] | 241 | |
---|
[cd218e8] | 242 | // character literals |
---|
[62edde5] | 243 | |
---|
[cd218e8] | 244 | ' '; 'a'; '"'; '_'; |
---|
| 245 | '\''; '\"'; '\?'; '\\'; // simple escape |
---|
| 246 | '\a'; '\b'; '\e'; /* GCC */ '\f'; '\n'; '\r'; '\t'; '\v'; |
---|
| 247 | '\0'; '\377'; // octal escape |
---|
| 248 | '\xf'; '\xff'; // hex escape |
---|
[62edde5] | 249 | |
---|
[cd218e8] | 250 | u' '; u'a'; u'"'; u'_'; |
---|
| 251 | U' '; U'a'; U'"'; U'_'; |
---|
| 252 | L' '; L'a'; L'"'; L'_'; |
---|
[62edde5] | 253 | |
---|
| 254 | // warnings/errors |
---|
| 255 | |
---|
[cd218e8] | 256 | #ifdef ERROR |
---|
| 257 | ''; // empty character |
---|
| 258 | 'aa'; // multi-character |
---|
| 259 | 'a\na'; // multi-character, embedded escape |
---|
| 260 | 'a\0a'; |
---|
| 261 | '\xfff'; // hex escape out of range |
---|
| 262 | '_\377_'; // multi-character |
---|
| 263 | '_\xff_'; |
---|
| 264 | '\xffff'; // hex escape out of range |
---|
| 265 | 'a\xff34w'; |
---|
| 266 | '\xf_f'; // multi-character |
---|
| 267 | '\xff_ff'; |
---|
| 268 | #endif // ERROR |
---|
| 269 | |
---|
| 270 | // string literals |
---|
| 271 | |
---|
| 272 | " "; "a"; "'"; '_'; "abcdefghijklmnopqrstuvwxyz"; |
---|
| 273 | ""; "aa"; "a\na"; "a\0a"; "_\377_"; "_\xff_"; "\xf_f"; |
---|
| 274 | "\'"; "\""; "\?"; "\\"; // simple escape |
---|
| 275 | "\a"; "\b"; "\e"; /* GCC */ "\f"; "\n"; "\r"; "\t"; "\v"; |
---|
| 276 | "\0"; "\377"; // octal escape |
---|
| 277 | "\xf"; "\xff"; // hex escape |
---|
| 278 | |
---|
| 279 | u8" "; u8"a"; u8"'"; u'_'; u8"abcdefghijklmnopqrstuvwxyz"; |
---|
| 280 | u" "; u"a"; u"'"; u'_'; u"abcdefghijklmnopqrstuvwxyz"; |
---|
| 281 | U" "; U"a"; U"'"; U'_'; U"abcdefghijklmnopqrstuvwxyz"; |
---|
| 282 | L" "; L"a"; L"'"; L'_'; L"abcdefghijklmnopqrstuvwxyz"; |
---|
| 283 | |
---|
| 284 | "\xFF"; u"\xFFFF"; U"\xFFFFFFFF"; L"\xFFFFFFFF"; // maximum size |
---|
| 285 | |
---|
| 286 | // concatenation |
---|
| 287 | |
---|
[ea0c5e3] | 288 | "\x12" "3"; // 2 characters not 1! |
---|
[cd218e8] | 289 | |
---|
[ea0c5e3] | 290 | "a" "b" u8"c"; |
---|
| 291 | "a" u8"b" "c"; |
---|
| 292 | "a" u8"b" u8"c"; |
---|
| 293 | u8"a" "b" u8"c"; |
---|
| 294 | u8"a" u8"b" u8"c"; |
---|
[cd218e8] | 295 | |
---|
| 296 | "a" "b" u"c"; |
---|
| 297 | "a" u"b" "c"; |
---|
[ea0c5e3] | 298 | "a" u"b" u"c"; |
---|
[cd218e8] | 299 | u"a" "b" u"c"; |
---|
| 300 | u"a" u"b" u"c"; |
---|
[62edde5] | 301 | |
---|
[ea0c5e3] | 302 | "a" "b" U"c"; |
---|
| 303 | "a" U"b" "c"; |
---|
| 304 | "a" U"b" U"c"; |
---|
| 305 | U"a" "b" U"c"; |
---|
| 306 | U"a" U"b" U"c"; |
---|
| 307 | |
---|
| 308 | "a" "b" L"c"; |
---|
| 309 | "a" L"b" "c"; |
---|
| 310 | "a" L"b" L"c"; |
---|
| 311 | L"a" "b" L"c"; |
---|
| 312 | L"a" L"b" L"c"; |
---|
| 313 | |
---|
[62edde5] | 314 | // warnings/errors |
---|
| 315 | |
---|
[cd218e8] | 316 | #ifdef ERROR |
---|
| 317 | "\xff_ff"; |
---|
| 318 | "\xfff"; // hex escape out of range |
---|
| 319 | "a\xff34w"; |
---|
| 320 | "\xffff"; |
---|
| 321 | #endif // ERROR |
---|
[62edde5] | 322 | } |
---|
| 323 | |
---|
| 324 | // Local Variables: // |
---|
[cd218e8] | 325 | // tab-width: 4 // |
---|
| 326 | // compile-command: "cfa literals.c" // |
---|
[62edde5] | 327 | // End: // |
---|