Suppose we have some struct/enum T, whose size_of in std::mem - Rust is measured as 2^k * odd_number
Then, as long as we read/write T at boundaries of 2^k, there should be no alignment issues right? (regardless of T's repr)
Suppose we have some struct/enum T, whose size_of in std::mem - Rust is measured as 2^k * odd_number
Then, as long as we read/write T at boundaries of 2^k, there should be no alignment issues right? (regardless of T's repr)
I don’t know if it’s formally guaranteed to remain true in the future, but I believe that’s correct for now (and probably a long time to come):
size_of
is guaranteed to be a multiple of the alignment, as it’s the stride between successive elements in an arraysize_of
cannot be part of the type’s alignmentThis topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.