-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What guarantees are provided by repr(packed)? #318
Comments
I would strongly think so, that is the entire point after all. Things become a bit more tricky to describe with As for field ordering, I don't know if it has any effect. |
|
Yes, the padding contained inside field types (including trailing padding to make the size a multiple of the alignment) is unaffected. |
Submitted: rust-lang/reference#1163 |
Per the nomicon,
repr(packed)
guarantees that all inter-field padding is removed. However, the reference merely says that "packed
may also alter the padding between fields" (emphasis added).What guarantees does
repr(packed)
provide? In particular:repr(packed)
guarantee that all inter-field padding is removed?repr(packed)
guarantee that a type's layout is fixed in any way other than removing padding (e.g., field ordering)?The text was updated successfully, but these errors were encountered: