delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/06/07:07:30

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: sizeof(long double)
Date: Thu, 06 Mar 1997 12:13:01 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 41
Message-ID: <331EA6BD.15FB@LSTM.Ruhr-UNI-Bochum.De>
References: <Pine DOT SGI DOT 3 DOT 95 DOT 970305141038 DOT 8443A-100000 AT geb DOT gfy DOT ku DOT dk>
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Thomas Knudsen wrote:
> 
> Based on the figures in float.h, I have always believed, that a long
> double in djgpp corresponded to an 80 bit IEEE float. However, the
> following code fragment:
> 
> #include <stdio.h>
> #include <stdlib.h>
> int main(void){
>   printf("sizeof(long double)==%d\n", (int) sizeof(long double));
>   return 0;
> }
> 
> prints: sizeof(long double)==12
> 
> is this really true?
> 
> Thomas
You are basically right. On the other hand, variables
are aligned to 4-Byte boundaries in gcc, hence it
take 12 bytes, where the last two bytes are unused.
Other machines may require packing to 8 or 16 byte
boundaries, so things are not always the way they
seem  ;-)


-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* Voice/Fax Box: +49 2561 91371 2056                        *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019