Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!pasteur!ucbvax!decwrl!labrea!sri-unix!garth!smryan
From: smryan@garth.UUCP (Steven Ryan)
Newsgroups: comp.lang.c
Subject: Re: Optimal structure field ordering
Summary: Loose languages.
Message-ID: <806@garth.UUCP>
Date: 25 Jun 88 19:53:37 GMT
References: <163@navtech.uucp>
Reply-To: smryan@garth.UUCP (Steven Ryan)
Organization: INTERGRAPH (APD) -- Palo Alto, CA
Lines: 10

In article <163@navtech.uucp> mark@navtech.uucp (Mark Stevans) writes:
>                                        The easy way to save space on almost
>all C implementations is to sort your structure fields in order of descending
>size of the field type.

(Not being a C expert, I don't know if this true.)  A nice language definition
will say you can define fields but doesn't say what order they are allocated. It
would be better if the compiler can sort the fields to optimise access and
balance space/time. In this way you can write the structures as it makes sense
and not worry about dinking it for a particular machine.