🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #213

Re: "packed" objects (Oops! Forgot something!)

#213
From: Roland McGrath
Date: Wed, 01 Aug 1990 19:28
19 lines
1575 bytes
The only arguments I have heard against arbitrary reordering of structures are
that it is incompatible with C, and that it makes writing structures to files
less portable.

Being incompatible with C is not something I consider a valid reason for not
doing something.  That's why we have `extern "C"'.  A structure declared within
`extern "C"' would, of course, obey C's conventions and not get reordered.

Writing structures to files as they appear in memory is not portable anyway.
Even given the same machine (and thus the same sizes for the basic types and
the same byte and word orders), different compilers (or even different compiler
options) may use different padding in structures.

Are there any other arguments against allowing arbitrary reordering of
structures?
--
	Roland McGrath
	Free Software Foundation, Inc.
roland@ai.mit.edu, uunet!ai.mit.edu!roland
Technical Details
Message-ID: <MCGRATH.90Aug1122802@helen.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!umich!samsung!usc!ucsd!ucbvax!pasteur!helen.Berkeley.EDU!mcgrath
References: <56159@microsoft.UUCP> <56165@microsoft.UUCP> <6785@netxcom.DHL.COM> <6786@netxcom.DHL.COM> <GSTEIN.90Jul31194438@goober.oracle.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!umich!samsung!usc!ucsd!ucbvax!pasteur!helen.Berkeley.EDU!mcgrath
From: mcgrath@helen.Berkeley.EDU (Roland McGrath)
Newsgroups: comp.std.c++
Subject: Re: "packed" objects (Oops! Forgot something!)
Message-ID: <MCGRATH.90Aug1122802@helen.Berkeley.EDU>
Date: 1 Aug 90 19:28:02 GMT
References: <56159@microsoft.UUCP> <56165@microsoft.UUCP>
 <6785@netxcom.DHL.COM> <6786@netxcom.DHL.COM>
 <GSTEIN.90Jul31194438@goober.oracle.com>
Sender: news@pasteur.Berkeley.EDU
Organization: Hackers Anonymous International, Ltd., Inc. (Applications
 welcome)
Lines: 19
In-reply-to: gstein@oracle.com's message of 1 Aug 90 02:46:10 GMT