Article View: comp.std.c++
Article #397Re: Packing, Ordering, and Rearranging
From: Roland McGrath
Date: Mon, 20 Aug 1990 23:31
Date: Mon, 20 Aug 1990 23:31
30 lines
1420 bytes
1420 bytes
In article <1233@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes:
You can definitely specify what you want the exact layout of a struct to be
in C and have it be obeyed and have it be portable. People do it all the
time. Now if only this were possible in C++. :-(
Since this newsgroup is about the standard for C++, I'll assume you are talking
about standard-conforming implementations of C as well. In this context, your
assertion is patently false. Given the definition:
struct
{
int elt0;
int elt1;
} foo;
any of the following layouts are entirely permissable within standard C:
0: elt0
4: elt1
0: elt0
8: elt1
0: elt0
1000000:elt1
--
Roland McGrath
Free Software Foundation, Inc.
roland@ai.mit.edu, uunet!ai.mit.edu!roland
Technical Details
Message-ID:
<ROLAND.90Aug20193125@wookumz.ai.mit.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!ai-lab!wookumz.ai.mit.edu!rolandReferences:
<1030@lupine.NCD.COM> <56637@microsoft.UUCP> <195@xstor.UUCP> <1233@lupine.NCD.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!ai-lab!wookumz.ai.mit.edu!roland From: roland@ai.mit.edu (Roland McGrath) Newsgroups: comp.std.c++ Subject: Re: Packing, Ordering, and Rearranging Message-ID: <ROLAND.90Aug20193125@wookumz.ai.mit.edu> Date: 20 Aug 90 23:31:25 GMT References: <1030@lupine.NCD.COM> <56637@microsoft.UUCP> <195@xstor.UUCP> <1233@lupine.NCD.COM> Sender: news@wheaties.ai.mit.edu Organization: Hackers Anonymous International, Ltd., Inc. (Applications welcome) Lines: 30 In-reply-to: rfg@NCD.COM's message of 18 Aug 90 08:10:39 GMT