On Monday, 5 February 2024 at 17:28:38 UTC, Iain Buclaw wrote:
Padding.
x86 ABI prefers things to be aligned, so on x86 it's 12 bytes,
x86_64 16 bytes. In both cases you don't get any extra
precision over the 80-bits that x87 gives you.
This is exactly what I mean. The ABI may pad it, but sizeof
should still give the number of bytes that are really used (not
counting the gaps).
Or is there a way to change the alignment of basic types?
In my code I wanted do decide if the processor uses
double-extended or quadruple as real depending on the sizeof.
But now I learned I cannot rely on this. Fortunately there is
mant_dig, which gives the correct info.
At least in an array of real I would expect no padding, like in
an array of bool (except for odd length).