www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/01/05:16:21

Xref: news-dnh.mv.net comp.os.msdos.djgpp:2974
Path: news-dnh.mv.net!mv!news.sprintlink.net!newsfeed.internetmci.com!in2.uu.net!genmagic!goonsquad.spies.com!uuwest!alcyone!max
From: max AT alcyone DOT darkside DOT com (Erik Max Francis)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Determining proper sizeof a struct
Date: Tue, 31 Oct 95 07:34:57 PST
References: <DHAzvK DOT 7zn AT jade DOT mv DOT net>
Organization: &tSftDotIotE
Lines: 17
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> writes:

> Gcc (and other 32-bit compilers) pad structures so that they could be 
> accessed faster by 32-bit processors (there is a penalty of accessing 
> unaligned addresses).  It is usually wrong to assume that sizeof of a 
> struct is the sum of the sizes of its fields; . . .

In fact, the ANSI C standard indicates that there can be padding, so 
assuming that thtere is no padding is not only not generally right, 
but also violates the ANSI standard.


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 || http://www.spies.com/max/
"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