www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/08/01/02:13:55

Xref: news-dnh.mv.net comp.os.msdos.djgpp:1275
Path: news-dnh.mv.net!mv!news.sprintlink.net!howland.reston.ans.net!agate!albert.ssl.berkeley.edu!korpela
From: korpela AT albert DOT ssl DOT berkeley DOT edu (Eric J. Korpela)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GCC/DJGPP Weirdness (structure padding stuff)
Date: 31 Jul 1995 18:27:56 GMT
Organization: Cal Berkeley-- Space Sciences Lab
Lines: 22
References: <DCFFCA DOT Ev3 AT jade DOT mv DOT net>
Nntp-Posting-Host: albert.ssl.berkeley.edu
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

In article <DCFFCA DOT Ev3 AT jade DOT mv DOT net>,
A.Appleyard <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk> wrote:
>  ghogenso AT u DOT washington DOT edu (Gordon Hogenson) wrote:-
>
>Why not pack structs etc anyway by default? On a PC, (rounding every member's
>width to a multiple of 2 or 4 bytes) achieves nothing except wasting store and
>annoying people who want to make a struct match some assembly-coded table (as
>e.g. when calling some interrupts).

There is a speed penalty for not aligning structures.  Access to an unaligned
int takes two memory accesses. Access to an unaligned short could take two
memory accesses. (Especially if it happens to be in 16 bit memory (of which
I have 8 megs)).

It's also important if you want to use your object files on a Unix system
where aligned access is enforced.

Eric
-- 
Eric Korpela                        |  An object at rest can never be
korpela AT ssl DOT berkeley DOT edu            |  stopped.
<a href="http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpela/w">Click here for more info.</a>

- Raw text -


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