News for hackers. Stuff that matters.
Re:Why introduce `std::launder` rather than have the compile... by webkike on Saturday January 22, 2022 @07:52AM (#30036231)
I’ve fixed undefined behavior in large C++ code based caused by misaligned reinterpret casts - the solution is to use memcpy
Re:Why introduce `std::launder` rather than have the compile... by allo37 on Saturday January 22, 2022 @08:26AM (#30036403)
It's such a good idea that they made a special cast that does just that in C++20: https://en.cppreference.com/w/cpp/numeric/bit_cast
Re:Why introduce `std::launder` rather than have the compile... by sgerenser on Saturday January 22, 2022 @10:51AM (#30037672)
And in most cases (at least in optimized builds) the memcpy will be optimized out.