Mail Archives: djgpp/1995/11/06/03:15:11

Xref: comp.os.msdos.djgpp:3058
From: max AT alcyone DOT darkside DOT com (Erik Max Francis)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Determining proper sizeof a struct
Date: Mon, 30 Oct 95 18:18:57 PST
References: <4738q2$a5n AT news DOT atlcom DOT net>
Organization: &tSftDotIotE
Lines: 26
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

gt7010a AT prism DOT gatech DOT edu (Ojas Parekh) writes:

> This program prints a value of 148 for sizeof(ulfrec) under both
> DJGPPV2 and DJGPP 1.12m4, but the value should be 146.
> Compiled under BC 3.1, this same program reports 146 for
> sizeof(ulfrec) as it should.  Is there something about gcc/DJGPP
> data types that I am not aware of?  Thanks.

"Should be"?  By what argument do you figure that?

The ANSI C standard makes no guarantee that all members of a struct 
will be contiguous; there may be some padding (extra unused space) 
here and there for efficiency sake; in many cases, on many 
architectures, it's more efficient to access data of one type than 

There's an attribute you can use to force DJGPP to completely pack all 
members of the structure; search through the info files under gcc for 
"attribute" and you should uncover it.

Erik Max Francis, &tSftDotIotE || uuwest!alcyone!max, max AT alcyone DOT darkside DOT com
San Jose, California, U.S.A. || 37 20 07 N 121 53 38 W || the 4th R is respect
H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- || 1love || folasade
_Omnia quia sunt, lumina sunt._ || GIGO Omega Psi ||
"Hands that once picked cotton can now pick Presidents."      -- Jesse Jackson

- Raw text -

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