-
Notifications
You must be signed in to change notification settings - Fork 27
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
question: why is Buf32 #[repr(packed)] #29
Comments
For The @kmcallister, could |
Using It seems redundant, unless you have some very special use of Buf32? With its fields being of size 8, 4, 4 bytes (64-bit) and 4, 4, 4 bytes (32-bit), the struct already doesn't use any padding at all on common platforms. |
@bluss Per rust-lang/rust#27060, See my comment above: I think |
since |
Even worse, generic custom code might ask |
Ok, I’m pretty sure we can safely remove |
I would use |
I suppose this unsafe code should probably use an So, yeah. In the meantime we should probably remove |
I'm looking into fixing Tendril and Buf32 by using repr(C). @SimonSapin, do you know what the Header struct is for? |
Non-inline tendrils (any tendril with more than 8 bytes of data) have a heap allocated chuck of memory that starts with a |
#33 switches |
If I understand https://doc.rust-lang.org/nomicon/other-reprs.html#reprpacked correctly,
#[repr(packed)]
forces byte alignment. And it sounds like this may be problematic:I very new to Rust (and system level programming), but this sounds scary to me.
Could you explain, why the
Buf32
should be packed?The text was updated successfully, but these errors were encountered: