Skip to content

Commit 959759c

Browse files
authored
docs: update literals introduction with C++23 standard information (#907)
1 parent 27ac6e5 commit 959759c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

concepts/literals/introduction.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ auto net_worth_carlisle_cullen{46'000'000'000LL}; // int and uint are not enough
3333
Floating-point numbers usually resolve to `double` during compilation.
3434
This is a good default case and use-cases with the narrower `float` type are less frequent than the unsigned example above.
3535
36+
~~~~exercism/advanced
37+
The [C++23 standard][cpp23-literals] introduces more fine grained control with literals like `f128` or `F16`.
38+
Some compilers allow their own literals.
39+
GCC permits the usage of `d` as a literal, but this is not foreseen in the standard and can hinder cross-platform compatibility.
40+
41+
[cpp23-literals]: https://en.cppreference.com/w/cpp/language/floating_literal
42+
43+
~~~~
44+
3645
```cpp
3746
auto light_year_in_m{9.46073e+15f}; // well in the range of float
3847
auto earth_to_edge_comoving_distance_in_nm{4.32355e+32}; // needs double type for magnitude

0 commit comments

Comments
 (0)