You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* The availability of suffix `UZ` for unsigned `size_t` literals (and `Z` for signed `size_t`) is new to C++23. On 32-bit machines `long` and `size_t` are usually 32 bits, while `long long` is guaranteed to be (at least) 64 bits on all platforms.
149
+
* The "size types" `std::size_t` (unsigned) and `std::ssize_t` (signed) are present in the Standard Library, and so require a header which defines them, such as `<cstddef>`. (Negative values for `std::ssize_t` are typically used to represent error values.)
150
+
151
+
+ On 32-bit machines `long`, `unsigned long`, `ssize_t` and `size_t` are usually 32 bits, and are usually 64 bits on 64-bit machines, while `long long` and `unsigned long long` are guaranteed to be (at least) 64 bits on all platforms.
149
152
150
153
The variable definition `double n{2.3};` should by now appear familiar and correct; it assigns a floating-point number (actually as shown in the table, a numeric literal) to a double precision variable. In other words it's an exact match between the declared type and the literal type. (If it were a narrowing cast, such as `double n{2.3L}` we would expect compilation to fail.)
151
154
@@ -209,10 +212,12 @@ Suffixes can apply to either integer or floating point literals (both in the cas
209
212
| l, L | extended precision float OR long integer | 100'000l, 3.3L |
210
213
| u, U | unsigned integer | 65536u, -1U |
211
214
| ll, LL | long long integer (64 bits) | 0ll, -1'234'567LL |
212
-
| uz, UZ | unsigned size type (size_t) | 0uz, 4'294'967'296UZ |
213
-
| z, Z | signed size type (size_t) | 0z, 4'294'967'296Z |
215
+
| uz, UZ | unsigned size type (std::size_t) | 0uz, 4'294'967'296UZ |
216
+
| z, Z | signed size type (std::ssize_t) | 0z, -2'147'483'648Z |
217
+
218
+
Note there is no literal for `short int` and there is unlikely to ever be one, as the `s` suffix is used for seconds when using the `<chrono>` header (and `string` when used with the `<string>` header). Also, the integer literal suffixes don't ever actually need to be used in Modern C++, source-code literals in all bases are automatically *promoted* (widened) to a type that can hold the value of the literal.
214
219
215
-
Note there is no literal for `short int` and there is unlikely to ever be one, as the `s` suffix is used for seconds when using the `<chrono>` header (and `string` when used with the `<string>` header). Also, the integer literal suffixes don't ever actually need to be used in Modern C++, source-code literals in all bases are automatically *promoted* (widened) to a type that can hold the value of the literal. To enable all the literal suffixes in the Standard Library use:
220
+
To enable all the literal suffixes in the Standard Library (assuming the necessary header(s) is/are present) use:
216
221
217
222
```cpp
218
223
usingnamespacestd::literals; // This is also implied by "using namespace std;"
0 commit comments