Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Walter Banks Newsgroups: comp.std.c Subject: Re: Structure Packing. Date: Mon, 11 Jun 2012 22:39:54 -0400 Organization: Aioe.org NNTP Server Lines: 22 Message-ID: <4FD6ABFA.72F52C75@bytecraft.com> References: <12b3df42-f6a0-4411-a5e5-136900f8255b@googlegroups.com> NNTP-Posting-Host: EzsqSu18dUrSPYyBwPJbtw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Mailer: Mozilla 4.79 [en]C-CCK-MCD NSCPCD479 (Windows NT 5.0; U) X-Accept-Language: en X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.std.c:1365 James Kuyper wrote: > Yes, the standard allows padding between members and after the last > member (but not before the first member). It's rare for an > implementation to insert such padding between two members with the same > alignment requirements, but perfectly permissible. > > > I just always feel uneasy when I see code that relies on the above structure being packed together without an explicit pack pragma. > > is this just my paranoia? > > No, it's quite reasonable to be worried about this. A current compiler project I am working on potentially has a completely different twist on struct placement. There is quite a list of hardware based alignment requirements based on boundaries. It is a RAM poor processor and I am being very tempted to assign global variables in the holes left behind in global structs. My guess the need for RAM space will outweigh other considerations. Walter..