Hi all, On Donnerstag, 29. September 2022 23:54:04 CEST Paul Boddie wrote:
On Thursday, 29 September 2022 22:15:06 CEST Paul Boddie wrote:
So this kind of explains some of my earlier confusion about what should happen on a 32-bit system. In fact, IA32 (x86) seems to be a special case, although I cannot immediately find the documentation that explains why the structure member alignment should be different from the rules applying to other architectures.
Here is something that might be relevant:
"System V Application Binary Interface Intel386 Architecture Processor Supplement Version 1.0"
https://uclibc.org/docs/psABI-i386.pdf
Specifically, table 2.1 on page 8 shows that the long long types are 64-bit types with 32-bit alignment.
True, and gcc confirms that: $ cat foo.cc #include <cstdio> int main() { printf("%zd\n", alignof(long long)); return 0; } $ uname -m x86_64 $ g++ -Wall -Wextra -o foo foo.cc && ./foo 8 $ g++ -m32 -Wall -Wextra -o foo foo.cc && ./foo 4 Kind regards, Frank -- Dr.-Ing. Frank Mehnert, frank.mehnert@kernkonzept.com, +49-351-41 883 224 Kernkonzept GmbH. Sitz: Dresden. Amtsgericht Dresden, HRB 31129. Geschäftsführer: Dr.-Ing. Michael Hohmuth