diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 030ce7c..33bda3f 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -8810,12 +8810,12 @@ If you wanted to see the bytes of an `int`, use a (named) cast: void if_you_must_pun(int& x) { - auto p = reinterpret_cast(&x); + auto p = reinterpret_cast(&x); cout << p[0] << '\n'; // OK; better // ... } -Accessing the result of a `reinterpret_cast` to a type different from the object's declared type is defined behavior. (Using `reinterpret_cast` is discouraged, +Accessing the result of a `reinterpret_cast` from the object's declared type to `char*`, `unsigned char*`, or `std::byte*` is defined behavior. (Using `reinterpret_cast` is discouraged, but at least we can see that something tricky is going on.) ##### Note