mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 12:36:56 +00:00
In some places we use the `*reinterpret_cast<const net::packed<T>*>(&x)` pattern to reinterpret memory. This is a violation of C++'s aliasing rules, which invokes undefined behaviour. The blessed way to correctly reinterpret memory is to copy it into a new object. Let's do that. Note: the reinterpret_cast way has no performance advantage. Compilers recognize the memory copy pattern and optimize it away. Closes #8241 * github.com:scylladb/scylla: treewide: get rid of unaligned_cast treewide: get rid of incorrect reinterpret casts