🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #22128

Re: RISC Machine Data Structure Word Alignment Problems?

#22128
From: carl weidling
Date: Fri, 02 Feb 1990 16:53
30 lines
2092 bytes
	The question is whether or not C's requirement to build structures
with the components in the order in which they were declared is a mistake
or not.
In article <1990Jan29.173412.2859@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
	< stuff deleted >
>The basic problem here is that the compiler cannot read minds, and the
>language does not provide a way to tell the compiler which of two
>interpretations is wanted.  The two possibilities are "I want precise
>control of what goes into memory" and "I want these members but please
>pad as necessary to make accesses fast".  Unfortunately, you can't just
>say "well, if I want padding I'll put it in myself", because many people
>want to write portable programs, and the padding requirements are *very*
>machine-specific.  Precise control of memory layout is not necessary for
	< rest of article deleted>
	Reading this I got an idea which is a slight variation on the idea
of a pragma or directive in the language.
	Why not have a PRE-processor directive that will re-arrange the
fields in a structure to maximize efficiency one way or the other? The
C-language itself is untouched, the programmer can run the pre-processor
by itself on the code to see what was done.  Perhaps lint could be made
smart enough to tell if someone was playing too many games with one of
these re-arranged structures. Something like
struct { int alpha;
#ARRANGE_ANY_WAY_YOU_WANT /* maybe specify criteria? i.e. speed vs compact */
	 long beta;
	 char gamma[3];
#END_ARRANGE
	}
-Carl Weidling
Technical Details
Message-ID: <8314@sybase.sybase.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!mtxinu!sybase!mercury!carlw
References: <111@melpar.UUCP> <51385@bbn.COM> <1990Jan29.173412.2859@utzoo.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!mtxinu!sybase!mercury!carlw
From: carlw@mercury.sybase.com (carl weidling)
Newsgroups: comp.arch,comp.lang.c,comp.lang.c++
Subject: Re: RISC Machine Data Structure Word Alignment Problems?
Message-ID: <8314@sybase.sybase.com>
Date: 2 Feb 90 16:53:42 GMT
References: <111@melpar.UUCP> <51385@bbn.COM> <1990Jan29.173412.2859@utzoo.uucp>
Sender: news@Sybase.COM
Reply-To: carlw@mercury.UUCP (carl weidling)
Organization: Sybase, Inc.
Lines: 30