1 | // |
---|
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. |
---|
6 | // |
---|
7 | // literals.cfa -- |
---|
8 | // |
---|
9 | // Author : Peter A. Buhr |
---|
10 | // Created On : Sat Sep 9 16:34:38 2017 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Tue Feb 12 08:07:39 2019 |
---|
13 | // Update Count : 224 |
---|
14 | // |
---|
15 | |
---|
16 | #include <features.h> // __GNUC_PREREQ |
---|
17 | #ifdef __CFA__ |
---|
18 | #include <fstream.hfa> |
---|
19 | |
---|
20 | void f( char v ) { sout | "char " | v; } |
---|
21 | void f( signed char v ) { sout | "signed char " | v; } |
---|
22 | void f( unsigned char v ) { sout | "unsigned char " | v; } |
---|
23 | void f( signed short v ) { sout | "signed short int" | v; } |
---|
24 | void f( unsigned short v ) { sout | "unsigned short int" | v; } |
---|
25 | void f( size_t v ) { sout | "size_t" | v; } |
---|
26 | #endif // __CFA__ |
---|
27 | |
---|
28 | //#define ERROR |
---|
29 | |
---|
30 | int main() { |
---|
31 | // integer literals |
---|
32 | |
---|
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 | |
---|
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; |
---|
80 | +0123456789.e-09; +0123456789.e-09f; +0123456789.e-09l; +0123456789.e-09F; +0123456789.e-09L; +0123456789.e-09DL; |
---|
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; |
---|
112 | +0123456789.0123456789E-09; +0123456789.0123456789E-09f; +0123456789.0123456789E-09l; +0123456789.0123456789E-09F; +0123456789.0123456789E-09L; +0123456789.0123456789E-09DL; |
---|
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; |
---|
126 | +0x0123456789.p-09; +0x0123456789.p-09f; +0x0123456789.p-09l; +0x0123456789.p-09F; +0x0123456789.p-09L; |
---|
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; |
---|
138 | +0x.0123456789P-09; +0x.0123456789P-09f; +0x.0123456789P-09l; +0x.0123456789P-09F; +0x.0123456789P-09L; |
---|
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; |
---|
150 | +0X0123456789.0123456789P-09; +0X0123456789.0123456789P-09f; +0X0123456789.0123456789P-09l; +0X0123456789.0123456789P-09F; +0X0123456789.0123456789P-09L; |
---|
151 | -0X0123456789.0123456789P-09; -0X0123456789.0123456789P-09f; -0X0123456789.0123456789P-09l; -0X0123456789.0123456789P-09F; -0X0123456789.0123456789P-09L; |
---|
152 | |
---|
153 | #if defined(__GNUC__) && __GNUC_PREREQ(7,0) // gcc version >= 7 |
---|
154 | // floating with length, gcc f16/f128x unsupported and no prelude code for any _FloatXXx, so they work by conversion to long double |
---|
155 | |
---|
156 | /* 0123456789.f16; */ 0123456789.f32; 0123456789.f32x; 0123456789.f64; 0123456789.f64x; 0123456789.W; 0123456789.f128; 0123456789.q; /* 0123456789.f128x; */ |
---|
157 | /* +0123456789.f16; */ +0123456789.f32; +0123456789.f32x; +0123456789.f64; +0123456789.f64x; +0123456789.w; +0123456789.f128; +0123456789.Q; /* +0123456789.f128x; */ |
---|
158 | /* -0123456789.f16; */ -0123456789.f32; -0123456789.f32x; -0123456789.f64; -0123456789.f64x; -0123456789.W; -0123456789.f128; -0123456789.q; /* -0123456789.f128x; */ |
---|
159 | |
---|
160 | /* 0123456789.e09F16; */ 0123456789.e09F32; 0123456789.e09F32x; 0123456789.e09F64; 0123456789.e09F64x; 0123456789.e09W; 0123456789.e09F128; 0123456789.e09q; /* .0123456789e09q; */ |
---|
161 | /* +0123456789.e+09F16; */ +0123456789.e+09F32; +0123456789.e+09F32x; +0123456789.e+09F64; +0123456789.e+09F64x; +0123456789.e+09w; +0123456789.e+09F128; +0123456789.e+09Q; /* +.0123456789E+09Q; */ |
---|
162 | /* -0123456789.e-09F16; */ -0123456789.e-09F32; -0123456789.e-09F32x; -0123456789.e-09F64; -0123456789.e-09F64x; -0123456789.e-09W; -0123456789.e-09F128; -0123456789.e-09q; /* -.0123456789E-09q; */ |
---|
163 | |
---|
164 | /* .0123456789e09F16; */ .0123456789e09F32; .0123456789e09F32x; .0123456789e09F64; .0123456789e09F64x; .0123456789e09W; .0123456789e09F128; .0123456789e09q; /* .0123456789e09q; */ |
---|
165 | /* +.0123456789e+09F16; */ +.0123456789e+09F32; +.0123456789e+09F32x; +.0123456789e+09F64; +.0123456789e+09F64x; +.0123456789e+09w; +.0123456789e+09F128; +.0123456789e+09Q; /* +.0123456789E+09Q; */ |
---|
166 | /* -.0123456789e-09F16; */ -.0123456789e-09F32; -.0123456789e-09F32x; -.0123456789e-09F64; -.0123456789e-09F64x; -.0123456789e-09W; -.0123456789e-09F128; -.0123456789e-09q; /* -.0123456789E-09q; */ |
---|
167 | |
---|
168 | /* 0123456789.0123456789F16; */ 0123456789.0123456789F32; 0123456789.0123456789F32x; 0123456789.0123456789F64; 0123456789.0123456789F64x; 0123456789.0123456789W; 0123456789.0123456789F128; 0123456789.0123456789q; /* 0123456789.0123456789q; */ |
---|
169 | /* +0123456789.0123456789F16; */ +0123456789.0123456789F32; +0123456789.0123456789F32x; +0123456789.0123456789F64; +0123456789.0123456789F64x; +0123456789.0123456789w; +0123456789.0123456789F128; +0123456789.0123456789Q; /* +0123456789.0123456789Q; */ |
---|
170 | /* -0123456789.0123456789F16; */ -0123456789.0123456789F32; -0123456789.0123456789F32x; -0123456789.0123456789F64; -0123456789.0123456789F64x; -0123456789.0123456789W; -0123456789.0123456789F128; -0123456789.0123456789q; /* -0123456789.0123456789q; */ |
---|
171 | |
---|
172 | /* 0123456789.0123456789E09F16; */ 0123456789.0123456789E09F32; 0123456789.0123456789E09F32x; 0123456789.0123456789E09F64; 0123456789.0123456789E09F64x; 0123456789.0123456789E09W; 0123456789.0123456789E09F128; 0123456789.0123456789E09q; /* 0123456789.0123456789E09q; */ |
---|
173 | /* +0123456789.0123456789E+09F16; */ +0123456789.0123456789E+09F32; +0123456789.0123456789E+09F32x; +0123456789.0123456789E+09F64; +0123456789.0123456789E+09F64x; +0123456789.0123456789E+09w; +0123456789.0123456789E+09F128; +0123456789.0123456789E+09Q; /* +0123456789.0123456789E+09Q; */ |
---|
174 | /* -0123456789.0123456789E-09F16; */ -0123456789.0123456789E-09F32; -0123456789.0123456789E-09F32x; -0123456789.0123456789E-09F64; -0123456789.0123456789E-09F64x; -0123456789.0123456789E-09W; -0123456789.0123456789E-09F128; -0123456789.0123456789E-09q; /* -0123456789.0123456789E-09q; */ |
---|
175 | |
---|
176 | /* 0x123456789.p09f16; */ 0x123456789.p09f32; 0x123456789.p09f32x; 0x123456789.p09f64; 0x123456789.p09f64x; 0x123456789.p09W; 0x123456789.p09f128; 0x123456789.p09q; /* 0x123456789.p09f128x; */ |
---|
177 | /* +0x123456789.P+09f16; */ +0x123456789.P+09f32; +0x123456789.P+09f32x; +0x123456789.P+09f64; +0x123456789.P+09f64x; +0x123456789.P+09w; +0x123456789.P+09f128; +0x123456789.P+09Q; /* +0x123456789.P+09f128x; */ |
---|
178 | /* -0x123456789.P-09f16; */ -0x123456789.P-09f32; -0x123456789.P-09f32x; -0x123456789.P-09f64; -0x123456789.P-09f64x; -0x123456789.P-09W; -0x123456789.P-09f128; -0x123456789.P-09q; /* -0x123456789.P-09f128x; */ |
---|
179 | |
---|
180 | /* 0x123456789.p09F16; */ 0x123456789.p09F32; 0x123456789.p09F32x; 0x123456789.p09F64; 0x123456789.p09F64x; 0x123456789.p09W; 0x123456789.p09F128; 0x123456789.p09q; /* .0123456789p09q; */ |
---|
181 | /* +0x123456789.p+09F16; */ +0x123456789.p+09F32; +0x123456789.p+09F32x; +0x123456789.p+09F64; +0x123456789.p+09F64x; +0x123456789.p+09w; +0x123456789.p+09F128; +0x123456789.p+09Q; /* +.0123456789p+09Q; */ |
---|
182 | /* -0x123456789.p-09F16; */ -0x123456789.p-09F32; -0x123456789.p-09F32x; -0x123456789.p-09F64; -0x123456789.p-09F64x; -0x123456789.p-09W; -0x123456789.p-09F128; -0x123456789.p-09q; /* -.0123456789P-09q; */ |
---|
183 | |
---|
184 | /* 0X.0123456789p09F16; */ 0X.0123456789p09F32; 0X.0123456789p09F32x; 0X.0123456789p09F64; 0X.0123456789p09F64x; 0X.0123456789p09W; 0X.0123456789p09F128; 0X.0123456789p09q; /* 0X.0123456789p09q; */ |
---|
185 | /* +0X.0123456789p+09F16; */ +0X.0123456789p+09F32; +0X.0123456789p+09F32x; +0X.0123456789p+09F64; +0X.0123456789p+09F64x; +0X.0123456789p+09w; +0X.0123456789p+09F128; +0X.0123456789p+09Q; /* +0X.0123456789p+09Q; */ |
---|
186 | /* -0X.0123456789p-09F16; */ -0X.0123456789p-09F32; -0X.0123456789p-09F32x; -0X.0123456789p-09F64; -0X.0123456789p-09F64x; -0X.0123456789p-09W; -0X.0123456789p-09F128; -0X.0123456789p-09q; /* -0X.0123456789P-09q; */ |
---|
187 | |
---|
188 | /* 0x123456789.0123456789P09F16; */ 0x123456789.0123456789P09F32; 0x123456789.0123456789P09F32x; 0x123456789.0123456789P09F64; 0x123456789.0123456789P09F64x; 0x123456789.0123456789P09W; 0x123456789.0123456789P09F128; 0x123456789.0123456789P09q; /* 0x123456789.0123456789P09q; */ |
---|
189 | /* +0x123456789.0123456789P+09F16; */ +0x123456789.0123456789P+09F32; +0x123456789.0123456789P+09F32x; +0x123456789.0123456789P+09F64; +0x123456789.0123456789P+09F64x; +0x123456789.0123456789P+09w; +0x123456789.0123456789P+09F128; +0x123456789.0123456789P+09Q; /* +0x123456789.0123456789P+09Q; */ |
---|
190 | /* -0x123456789.0123456789p-09F16; */ -0x123456789.0123456789p-09F32; -0x123456789.0123456789p-09F32x; -0x123456789.0123456789p-09F64; -0x123456789.0123456789p-09F64x; -0x123456789.0123456789p-09W; -0x123456789.0123456789p-09F128; -0x123456789.0123456789p-09q; /* -0x123456789.0123456789p-09q; */ |
---|
191 | |
---|
192 | /* 0x123456789.0123456789P09F16; */ 0x123456789.0123456789P09F32; 0x123456789.0123456789P09F32x; 0x123456789.0123456789P09F64; 0x123456789.0123456789P09F64x; 0x123456789.0123456789P09W; 0x123456789.0123456789P09F128; 0x123456789.0123456789P09q; /* 0x123456789.0123456789P09q; */ |
---|
193 | /* +0x123456789.0123456789p+09F16; */ +0x123456789.0123456789p+09F32; +0x123456789.0123456789p+09F32x; +0x123456789.0123456789p+09F64; +0x123456789.0123456789p+09F64x; +0x123456789.0123456789p+09w; +0x123456789.0123456789p+09F128; +0x123456789.0123456789p+09Q; /* +0x123456789.0123456789p+09Q; */ |
---|
194 | /* -0x123456789.0123456789P-09F16; */ -0x123456789.0123456789P-09F32; -0x123456789.0123456789P-09F32x; -0x123456789.0123456789P-09F64; -0x123456789.0123456789P-09F64x; -0x123456789.0123456789P-09W; -0x123456789.0123456789P-09F128; -0x123456789.0123456789P-09q; /* -0x123456789.0123456789P-09q; */ |
---|
195 | #endif // __GNUC_PREREQ(7,0) |
---|
196 | |
---|
197 | #ifdef __CFA__ |
---|
198 | // fixed-size length |
---|
199 | |
---|
200 | // binary |
---|
201 | 0b01101011_l8; 0b01101011_l16; 0b01101011_l32; 0b01101011_l64; 0b01101011_l8u; 0b01101011_ul16; 0b01101011_l32u; 0b01101011_ul64; |
---|
202 | +0b01101011_l8; +0b01101011_l16; +0b01101011_l32; +0b01101011_l64; +0b01101011_l8u; +0b01101011_ul16; +0b01101011_l32u; +0b01101011_ul64; |
---|
203 | -0b01101011_l8; -0b01101011_l16; -0b01101011_l32; -0b01101011_l64; -0b01101011_l8u; -0b01101011_ul16; -0b01101011_l32u; -0b01101011_ul64; |
---|
204 | |
---|
205 | #ifdef __LP64__ // 64-bit processor |
---|
206 | 0b01101011_l128; 0b01101011_ul128; |
---|
207 | +0b01101011_l128; +0b01101011_ul128; |
---|
208 | -0b01101011_l128; -0b01101011_ul128; |
---|
209 | #endif // __LP64__ |
---|
210 | |
---|
211 | // octal |
---|
212 | 01234567_l8; 01234567_l16; 01234567_l32; 01234567_l64; 01234567_l8u; 01234567_ul16; 01234567_l32u; 01234567_ul64; |
---|
213 | +01234567_l8; +01234567_l16; +01234567_l32; +01234567_l64; +01234567_ul8; +01234567_ul16; +01234567_l32u; +01234567_ul64; |
---|
214 | -01234567_l8; -01234567_l16; -01234567_l32; -01234567_l64; -01234567_l8u; -01234567_ul16; -01234567_l32u; -01234567_ul64; |
---|
215 | |
---|
216 | #ifdef __LP64__ // 64-bit processor |
---|
217 | 01234567_l128; 01234567_ul128; |
---|
218 | +01234567_l128; +01234567_ul128; |
---|
219 | -01234567_l128; -01234567_ul128; |
---|
220 | #endif // __LP64__ |
---|
221 | |
---|
222 | // decimal |
---|
223 | 1234567890L8; 1234567890L16; 1234567890l32; 1234567890l64; 1234567890UL8; 1234567890L16U; 1234567890Ul32; 1234567890l64u; |
---|
224 | +1234567890L8; +1234567890L16; +1234567890l32; +1234567890l64; +1234567890UL8; +1234567890L16U; +1234567890Ul32; +1234567890l64u; |
---|
225 | -1234567890L8; -1234567890L16; -1234567890l32; -1234567890l64; -1234567890UL8; -1234567890L16U; -1234567890Ul32; -1234567890l64u; |
---|
226 | |
---|
227 | #ifdef __LP64__ // 64-bit processor |
---|
228 | 1234567890l128; 1234567890l128u; |
---|
229 | +1234567890l128; +1234567890l128u; |
---|
230 | -1234567890l128; -1234567890l128u; |
---|
231 | #endif // __LP64__ |
---|
232 | |
---|
233 | // hexadecimal |
---|
234 | 0x0123456789abcdef_l8; 0x0123456789abcdef_l16; 0x0123456789abcdefl32; 0x0123456789abcdefl64; 0x0123456789abcdef_ul8; 0x0123456789abcdef_l16u; 0x0123456789abcdeful32; 0x0123456789abcdefl64u; |
---|
235 | +0x0123456789abcdef_l8; +0x0123456789abcdef_l16; +0x0123456789abcdefl32; +0x0123456789abcdefl64; +0x0123456789abcdef_ul8; +0x0123456789abcdef_l16u; +0x0123456789abcdeful32; +0x0123456789abcdefl64u; |
---|
236 | -0x0123456789abcdef_l8; -0x0123456789abcdef_l16; -0x0123456789abcdefl32; -0x0123456789abcdefl64; -0x0123456789abcdef_ul8; -0x0123456789abcdef_l16u; -0x0123456789abcdeful32; -0x0123456789abcdefl64u; |
---|
237 | |
---|
238 | 0x0123456789ABCDEF_l8; 0x0123456789ABCDEF_l16; 0x0123456789ABCDEFl32; 0x0123456789ABCDEFl64; 0x0123456789ABCDEF_ul8; 0x0123456789ABCDEF_l16u; 0x0123456789ABCDEFul32; 0x0123456789ABCDEFl64u; |
---|
239 | +0x0123456789ABCDEF_l8; +0x0123456789ABCDEF_l16; +0x0123456789ABCDEFl32; +0x0123456789ABCDEFl64; +0x0123456789ABCDEF_ul8; +0x0123456789ABCDEF_l16u; +0x0123456789ABCDEFul32; +0x0123456789ABCDEFl64u; |
---|
240 | -0x0123456789ABCDEF_l8; -0x0123456789ABCDEF_l16; -0x0123456789ABCDEFl32; -0x0123456789ABCDEFl64; -0x0123456789ABCDEF_ul8; -0x0123456789ABCDEF_l16u; -0x0123456789ABCDEFul32; -0x0123456789ABCDEFl64u; |
---|
241 | |
---|
242 | 0X0123456789abcdef_l8; 0X0123456789abcdef_l16; 0X0123456789abcdefl32; 0X0123456789abcdefl64; 0X0123456789abcdef_ul8; 0X0123456789abcdef_l16u; 0X0123456789abcdeful32; 0X0123456789abcdefl64u; |
---|
243 | +0X0123456789abcdef_l8; +0X0123456789abcdef_l16; +0X0123456789abcdefl32; +0X0123456789abcdefl64; +0X0123456789abcdef_ul8; +0X0123456789abcdef_l16u; +0X0123456789abcdeful32; +0X0123456789abcdefl64u; |
---|
244 | -0X0123456789abcdef_l8; -0X0123456789abcdef_l16; -0X0123456789abcdefl32; -0X0123456789abcdefl64; -0X0123456789abcdef_ul8; -0X0123456789abcdef_l16u; -0X0123456789abcdeful32; -0X0123456789abcdefl64u; |
---|
245 | |
---|
246 | 0X0123456789ABCDEF_l8; 0X0123456789ABCDEF_l16; 0X0123456789ABCDEFl32; 0X0123456789ABCDEFl64; 0X0123456789ABCDEF_ul8; 0X0123456789ABCDEF_l16u; 0X0123456789ABCDEFul32; 0X0123456789ABCDEFl64u; |
---|
247 | +0X0123456789ABCDEF_l8; +0X0123456789ABCDEF_l16; +0X0123456789ABCDEFl32; +0X0123456789ABCDEFl64; +0X0123456789ABCDEF_ul8; +0X0123456789ABCDEF_l16u; +0X0123456789ABCDEFul32; +0X0123456789ABCDEFl64u; |
---|
248 | -0X0123456789ABCDEF_l8; -0X0123456789ABCDEF_l16; -0X0123456789ABCDEFl32; -0X0123456789ABCDEFl64; -0X0123456789ABCDEF_ul8; -0X0123456789ABCDEF_l16u; -0X0123456789ABCDEFul32; -0X0123456789ABCDEFl64u; |
---|
249 | |
---|
250 | // char, short, int suffix overloading |
---|
251 | |
---|
252 | f( 'a' ); |
---|
253 | f( 20_hh ); |
---|
254 | f( 21_hhu ); |
---|
255 | f( 22_h ); |
---|
256 | f( 23_uh ); |
---|
257 | f( 24z ); |
---|
258 | #endif // __CFA__ |
---|
259 | |
---|
260 | // character literals |
---|
261 | |
---|
262 | ' '; 'a'; '"'; '_'; |
---|
263 | '\''; '\"'; '\?'; '\\'; // simple escape |
---|
264 | '\a'; '\b'; '\e'; /* GCC */ '\f'; '\n'; '\r'; '\t'; '\v'; |
---|
265 | '\0'; '\377'; // octal escape |
---|
266 | '\xf'; '\xff'; // hex escape |
---|
267 | |
---|
268 | u' '; u'a'; u'"'; u'_'; |
---|
269 | U' '; U'a'; U'"'; U'_'; |
---|
270 | L' '; L'a'; L'"'; L'_'; |
---|
271 | |
---|
272 | // warnings/errors |
---|
273 | |
---|
274 | #ifdef ERROR |
---|
275 | ''; // empty character |
---|
276 | 'aa'; // multi-character |
---|
277 | 'a\na'; // multi-character, embedded escape |
---|
278 | 'a\0a'; |
---|
279 | '\xfff'; // hex escape out of range |
---|
280 | '_\377_'; // multi-character |
---|
281 | '_\xff_'; |
---|
282 | '\xffff'; // hex escape out of range |
---|
283 | 'a\xff34w'; |
---|
284 | '\xf_f'; // multi-character |
---|
285 | '\xff_ff'; |
---|
286 | #endif // ERROR |
---|
287 | |
---|
288 | // string literals |
---|
289 | |
---|
290 | " "; "a"; "'"; '_'; "abcdefghijklmnopqrstuvwxyz"; |
---|
291 | ""; "aa"; "a\na"; "a\0a"; "_\377_"; "_\xff_"; "\xf_f"; |
---|
292 | "\'"; "\""; "\?"; "\\"; // simple escape |
---|
293 | "\a"; "\b"; "\e"; /* GCC */ "\f"; "\n"; "\r"; "\t"; "\v"; |
---|
294 | "\0"; "\377"; // octal escape |
---|
295 | "\xf"; "\xff"; // hex escape |
---|
296 | |
---|
297 | u8" "; u8"a"; u8"'"; u'_'; u8"abcdefghijklmnopqrstuvwxyz"; |
---|
298 | u" "; u"a"; u"'"; u'_'; u"abcdefghijklmnopqrstuvwxyz"; |
---|
299 | U" "; U"a"; U"'"; U'_'; U"abcdefghijklmnopqrstuvwxyz"; |
---|
300 | L" "; L"a"; L"'"; L'_'; L"abcdefghijklmnopqrstuvwxyz"; |
---|
301 | |
---|
302 | "\xFF"; u"\xFFFF"; U"\xFFFFFFFF"; L"\xFFFFFFFF"; // maximum size |
---|
303 | |
---|
304 | // concatenation |
---|
305 | |
---|
306 | "\x12" "3"; // 2 characters not 1! |
---|
307 | |
---|
308 | "a" "b" u8"c"; |
---|
309 | "a" u8"b" "c"; |
---|
310 | "a" u8"b" u8"c"; |
---|
311 | u8"a" "b" u8"c"; |
---|
312 | u8"a" u8"b" u8"c"; |
---|
313 | |
---|
314 | "a" "b" u"c"; |
---|
315 | "a" u"b" "c"; |
---|
316 | "a" u"b" u"c"; |
---|
317 | u"a" "b" u"c"; |
---|
318 | u"a" u"b" u"c"; |
---|
319 | |
---|
320 | "a" "b" U"c"; |
---|
321 | "a" U"b" "c"; |
---|
322 | "a" U"b" U"c"; |
---|
323 | U"a" "b" U"c"; |
---|
324 | U"a" U"b" U"c"; |
---|
325 | |
---|
326 | "a" "b" L"c"; |
---|
327 | "a" L"b" "c"; |
---|
328 | "a" L"b" L"c"; |
---|
329 | L"a" "b" L"c"; |
---|
330 | L"a" L"b" L"c"; |
---|
331 | |
---|
332 | // warnings/errors |
---|
333 | |
---|
334 | #ifdef ERROR |
---|
335 | "\xff_ff"; |
---|
336 | "\xfff"; // hex escape out of range |
---|
337 | "a\xff34w"; |
---|
338 | "\xffff"; |
---|
339 | #endif // ERROR |
---|
340 | } |
---|
341 | |
---|
342 | // Local Variables: // |
---|
343 | // tab-width: 4 // |
---|
344 | // compile-command: "cfa literals.cfa" // |
---|
345 | // End: // |
---|