RISC Machine Data Structure Word Al

carroll at m.cs.uiuc.edu carroll at m.cs.uiuc.edu
Sat Feb 24 21:39:38 AEST 1990


>/* Written 11:34 am  Jan 29, 1990 by henry at utzoo.uucp in m.cs.uiuc.edu:comp.lang.c */
>In article <51385 at bbn.COM> jgrace at BBN.COM (Joe Grace) writes:
>>... I think the language, C (and C++), is to blame (and
>>would prefer C and C++ to pack struct members as suggested by
>>the programmer's struct definition).
>
>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.
>-- 
>1972: Saturn V #15 flight-ready|     Henry Spencer at U of Toronto Zoology
>1990: birds nesting in engines | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
>/* End of text from m.cs.uiuc.edu:comp.lang.c */

Wouldn't this be a place for a #pragma extension? I.e., the default behaviour
is to layout the structure in textual order as is done now, while a
#pragma PACK_STRUCTURES
would tell the compiler that the program doesn't depend on the ordering of
the structure members, and the compiler is free to rearrange them in order to
produce the minimum memory size based on alignment restrictions. This way
compilers without the pragma would still run the code, but pay the memory
cost.

Alan M. Carroll                "Like the north wind whistling down the sky,
carroll at cs.uiuc.edu             I've got a song, I've got a song.
Conversation Builder:           I carry it with me and I sing it loud
+ Tomorrow's Tools Today +      If it gets me nowhere, I'll go there proud"
Epoch Development Team          
CS Grad / U of Ill @ Urbana    ...{ucbvax,pur-ee,convex}!cs.uiuc.edu!carroll



More information about the Comp.lang.c mailing list