Skip to content

Commit fa5893e

Browse files
committed
C.183: Mention bit_cast as a C++20+ solution
1 parent 2a64d42 commit fa5893e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CppCoreGuidelines.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9032,7 +9032,8 @@ but at least we can see that something tricky is going on.)
90329032
Unfortunately, `union`s are commonly used for type punning.
90339033
We don't consider "sometimes, it works as expected" a conclusive argument.
90349034

9035-
C++17 introduced a distinct type `std::byte` to facilitate operations on raw object representation. Use that type instead of `unsigned char` or `char` for these operations.
9035+
C++17 and C++20 introduced `std::byte` and `std::bit_cast`, respectively, to facilitate operations on raw object representations. Use `std::byte` instead of
9036+
`unsigned char` or `char` for these operations.
90369037

90379038
##### Enforcement
90389039

0 commit comments

Comments
 (0)