Re: Bytes of long double - trouble . . .

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 8 Feb 2023 at 08:50, Sergey Smith wrote:
>
>
> To:     gcc-help@xxxxxxxxxxx
> Dear GCC,  [ 8:2:23  ]
>                   Like Woooew ! What is THIS!?  I installed Visual Studio Code, & your 32 bit C, Version 9.2.0. I ran :

What is "C"? That's not a compiler, what did you actually install? How
are you running it?

We can't help you with such vague, unclear descriptions of your question.

>    printf("\nOn THIS particular computer, long double is given %d bytes\n", sizeof(long double)); /* The Answer was: 12 bytes.
>    THEN, I updated to C Version 12.2.0 and ran the same code, - ON THE SAME COMPUTER, - but NOW the answer is:  16 bytes !
>
>     HOW can this happen if, as I understand it, - this function is supposed to assess a computer’s  *hardware* ?  I am on Windows 10 btw.

No, 'long double' is a C language type. The hardware has registers
that might be 32 bits, 64 bits, 80 bits or 128 bits wide. The 'long
double' type is implemented in the compiler to use the hardware in an
implementation defined way.

The most likely explanation is that your first program was compiled as
a 32-bit i686 program, where long double is 12 bytes, and your second
program was compiled as a 64-bit x86-64 program, where long double has
an extra 4 bytes of padding.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux