Uh oh!
There was an error while loading. Please reload this page.
Various cleanups. - #36
Conversation
Add debug implementations. Mark everything as repr(C) and repr(packed), just to be sure.
robert-w-gries
commented
Dec 6, 2017
👍 LGTM On an semi-related note, I'd appreciate help in understanding what's going on with This note from the
Since our case requires liberal use of Let me know if there's something to this, and I'll open a separate issue. |
phil-opp
commented
Dec 6, 2017
As I understand it, repr(C) should suffice as long as the fields are aligned. With repr(packed) everything should still work without undefined behavior as long as we avoid references to unaligned fields. rust-lang/rust#44884 was merged about a week ago, so this should make things safer (but I don't know details either). |
ahmedcharles
commented
Dec 7, 2017
I wish Rust had static assert, which would allow asserting the size of a struct to ensure there is no padding. I'll probably look into that and switch to using that as a way to verify that what you see is what you get, since using unsafe to access fields is somewhat silly in many cases. |
phil-opp
commented
Dec 7, 2017
We could add a unit test that checks the struct sizes. |
Add debug implementations.
Mark everything as repr(C) and repr(packed), just to be sure.