public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Sergey Smith <sergey-16a5@mail.ru>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Bytes of long double - trouble . . .
Date: Wed, 8 Feb 2023 11:11:34 +0000	[thread overview]
Message-ID: <CAH6eHdSGDA1E-FWhNTF+ZXYK7CLjdK-MEUjVkuZcDt3Cy7HT2Q@mail.gmail.com> (raw)
In-Reply-To: <1675846132.6232748@f313.i.mail.ru>

On Wed, 8 Feb 2023 at 08:50, Sergey Smith wrote:
>
>
> To:     gcc-help@gcc.gnu.org
> 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.

  parent reply	other threads:[~2023-02-08 11:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  8:48 Sergey Smith
2023-02-08  9:09 ` henri.cloetens
2023-02-08 11:12   ` Jonathan Wakely
2023-02-08 11:11 ` Jonathan Wakely [this message]
2023-02-15 12:50 ` Dennis Clarke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH6eHdSGDA1E-FWhNTF+ZXYK7CLjdK-MEUjVkuZcDt3Cy7HT2Q@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=sergey-16a5@mail.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).