Path: 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: Date: 1 Aug 90 19:28:02 GMT References: <56159@microsoft.UUCP> <56165@microsoft.UUCP> <6785@netxcom.DHL.COM> <6786@netxcom.DHL.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 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