delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/06/06:37:20

Date: Mon, 6 Jan 1997 13:29:22 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Roland Nilsson <roland DOT nilsson AT communique DOT se>
cc: djgpp AT delorie DOT com
Subject: Re: __attribute__((packed)) on types
In-Reply-To: <5aopgf$31h@news.luth.se>
Message-ID: <Pine.SUN.3.91.970106132817.24131E-100000@is>
MIME-Version: 1.0

On 5 Jan 1997, Roland Nilsson wrote:

> Oh. Now it works, thanks. Only problem is that the structure size
> still is expanded to a 4-byte boundary; The above structure would
> have foo::a at offset 0, foo::b at 1, but sizeof(foo) returns 8.
> But alright, this _is_ mentioned in the GCC manual. (Using the
> -fpack-struct argument yields sizeof(foo) = 5, however.)

That's because you can make an array of such structs, which still should 
be aligned to avoid runtime penalties.

- Raw text -


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