Optimal structure field ordering

John F. Haugh II jfh at rpp386.UUCP
Sat Jul 9 10:32:46 AEST 1988


In article <5233 at ihlpf.ATT.COM> nevin1 at ihlpf.UUCP (00704a-Liber,N.J.) writes:
>In article <3459 at rpp386.UUCP> jfh at rpp386.UUCP (The Beach Bum) writes:
>>it could be serious for any language to not specify how it rearranges
>>structures.  it could make it impossible for separate compilation to
>>work, period.
>
>Not quite true.  As long as the compiler internally arranges the fields in
>a structure the same way, no problems occur.  There is no need for you, the
>user of a compiler, to know what order fields are stored in, as long as the
>compiler is self-consistent (unless you are doing something like a block
>move into a structure).

provided there exists exactly one compiler in the entire universe.  for
without the assurance, via an agreed upon or written standard, that the
structures are arranged in a common fashion, no two ``self consistent''
compilers are neccessarily going to produce the same structure ordering.

and therein lies the beauty of a standard.  while separate compilation
may not be such a huge issue, using multiple compilers on a single machine,
is.

- john.
-- 
John F. Haugh II                 +--------- Cute Chocolate Quote ---------
HASA, "S" Division               | "USENET should not be confused with
UUCP:   killer!rpp386!jfh        |  something that matters, like CHOCOLATE"
DOMAIN: jfh at rpp386.uucp          |             -- with my apologizes



More information about the Comp.lang.c mailing list