mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-18 13:14:40 +03:00
@@ -9020,7 +9020,7 @@ If you wanted to see the bytes of an `int`, use a (named) cast:
|
|||||||
void if_you_must_pun(int& x)
|
void if_you_must_pun(int& x)
|
||||||
{
|
{
|
||||||
auto p = reinterpret_cast<std::byte*>(&x);
|
auto p = reinterpret_cast<std::byte*>(&x);
|
||||||
cout << p[0] << '\n'; // OK; better
|
cout << to_integer<unsigned>(p[0]) << '\n'; // OK; better
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user