You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to https://doc.rust-lang.org/stable/std/mem/fn.zeroed.html docs, std::mem::zeroed() on a struct with padding doesn't necessarily zero out the padding (which isn't very nice for libraries which do forward/backwards compat based on struct sizes.
Should there be padding generated for this struct? Or should the default() implementation be changed to actually zero padding?
The text was updated successfully, but these errors were encountered:
We try to not generate padding when not needed. I think a simple fix would be to add an option to change default() to not use zeroed(), but instead use uninitialized() then zero the relevant size.
Input C/C++ Header
Apologies for the
#include
s, not sure how to avoid it here.Bindgen Invocation
Actual Results
Expected Results
If you take the bindgen generated struct and also create a packed version (see https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=748d6dc00a88d3218bdb0bcf5912d667 ) and then print the sizes of regular and packed, there's a size difference. I think that means there's padding.
According to https://doc.rust-lang.org/stable/std/mem/fn.zeroed.html docs,
std::mem::zeroed()
on a struct with padding doesn't necessarily zero out the padding (which isn't very nice for libraries which do forward/backwards compat based on struct sizes.Should there be padding generated for this struct? Or should the
default()
implementation be changed to actually zero padding?The text was updated successfully, but these errors were encountered: