std.mem.bytesAsValue/asBytes for padded packed structs #10958
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Currently
std.mem.asBytes/bytesAsValue
cannot be used for packed structs that "may be" padded. I.e. if8*@sizeOf(T) != @bitSizeOf(T)
. In particular, this fails:With:
I've attempted to fix this in #10941 for
bytesAsValue
, butasBytes
is more nuanced. Before spending much more time on this, I'd like to receive a "consensus" that this (bytesAsValue/asBytes) is something that ought to work for byte-aligned packed structs. If yes, how it should behave for non-byte aligned or padded packed structs?The text was updated successfully, but these errors were encountered: