News for hackers. Stuff that matters.
Re:Structures in C: From Basics to Memory Alignment by LegionMammal978 on Friday June 30, 2023 @03:00AM (#36531465)
What's worse, MSVC's 32-bit x86 ABI reports an 8-byte alignment requirement (via __alignof) for 64-bit integer types, and its struct layout algorithm uses that alignment to determine padding, but those integers and structs are only aligned to 4 bytes when allocated on the stack! This has caused issues with Rust code trying to link with MSVC code [0], since Rust's standard library documentation asserts that properly aligned pointers have addresses that are always a multiple of the alignment used for struct layout.

[0] https://github.com/rust-lang/rust/issues/112480

There are no comments on this comment yet.