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: 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 , A.Appleyard 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. Click here for more info.