delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/14/02:16:14

From: George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Struct field aligning
Date: 13 Nov 1997 20:04:16 GMT
Organization: Oxford University, England
Message-ID: <64fmg0$p3b$1@news.ox.ac.uk>
References: <64fhj4$iev AT mn5 DOT swip DOT net>
NNTP-Posting-Host: sable.ox.ac.uk
Lines: 16
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 13 Nov 1997 18:40:36 GMT in comp.os.msdos.djgpp Johan Levin <johan AT technologist DOT com> wrote:

: In this case all elements of the structure becomes
: dword-aligned. That might be good for speed, but
: I'm trying to read the header of a file that doesn't
: align it's fields like this. Is it possible to disable
: this aligning for a structure?

Please refer to section 22.9 of the FAQ; it explains this in depth.
Briefly, you need to use the __attribute__ system to tell gcc to
`pack' the struct, i.e. remove all the padding.

-- 
Regards,

george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


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