🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #20646

Re: Sorting struct members for alignment (was Re: Unaligned Accesses)

#20646
From: Gord Deinstadt
Date: Thu, 30 Mar 1989 22:21
28 lines
1869 bytes
In article <4582@pt.cs.cmu.edu> bsy@PLAY.MACH.CS.CMU.EDU (Flexi-thumbs) writes:
>
>The big problem that you're referring to is probably the injunction against
>reordering structure members, viz., Section A8.3 of K&R 2nd Ed (pg 213).
>You'll find it in the ANSI std too.  So, the assumption is valid for all
>architectures that do not require padding before the first element of the
>struct.  Does anybody know of any?  I'd conjecture that no machine is that
>silly.

Even when (as in the original example) the first member is smaller than
a word?  I bet there are machines "that silly".  It's not a problem to
sensible code.

>[ Arguments why structure order is important in system programming. ]
>Until there's a keyword to explicitly allow/disallow member reordering (ala
>register), it is an implementation flaw to reorder structure members.

And it's about time there was such a keyword.  We've got a million plus
lines of C code here, and hardly a line of it needs to know what a structure
looks like internally.  For our purposes (as for most application programmers)
structure member reordering should be the default.

eat
this,
line
counter
-- 
Gord Deinstadt           gd@geovision.uucp
Technical Details
Message-ID: <583@geovision.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!mitel!sce!cognos!geovision!gd
References: <37196@bbn.COM> <1989Mar16.190043.23227@utzoo.uucp> <24889@amdcad.AMD.COM> <355@bnr-fos.UUCP> <13@microsoft.UUCP> <362@bnr-fos.UUCP> <59@microsoft.UUCP> <11118@pur-ee.UUCP> <4582@pt.cs.cmu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!mitel!sce!cognos!geovision!gd
From: gd@geovision.uucp (Gord Deinstadt)
Newsgroups: comp.arch
Subject: Re: Sorting struct members for alignment (was Re: Unaligned Accesses)
Keywords: alignment
Message-ID: <583@geovision.UUCP>
Date: 30 Mar 89 22:21:21 GMT
References: <37196@bbn.COM> <1989Mar16.190043.23227@utzoo.uucp> <24889@amdcad.AMD.COM> <355@bnr-fos.UUCP> <13@microsoft.UUCP> <362@bnr-fos.UUCP> <59@microsoft.UUCP> <11118@pur-ee.UUCP> <4582@pt.cs.cmu.edu>
Reply-To: gd@geovision.UUCP (Gord Deinstadt)
Organization: GeoVision Corp, Ottawa, Canada
Lines: 28