[RFH] A simple way to figure out the number of bits used by a long double
Tim Prince
n8tm@aol.com
Fri Feb 26 14:56:00 GMT 2010
On 2/26/2010 5:44 AM, Ed Smith-Rowland wrote:
> Huh. I would have *sworn* that sizeof(long double) was 10 not 16 even
> though we know it was 80 bits.
>
As you indicated before, sizeof gives the amount of memory displaced by
the object, including padding. In my experience with gcc, sizeof(long
double) is likely to be 12 on 32-bit platforms, and 16 on 64-bit
platforms. These choices are made to preserve alignment for 32-bit and
128-bit objects respectively, and to improve performance in the 64-bit
case, for hardware which doesn't like to straddle cache lines.
It seems the topic would have been more appropriate for gcc-help, if
related to gcc, or maybe comp.lang.c, if a question about implementation
in accordance with standard C.
--
Tim Prince
More information about the Gcc
mailing list