Optimal structure field ordering

Barnacle Wes wes at obie.UUCP
Tue Jun 28 11:00:31 AEST 1988


In article <806 at garth.UUCP>, smryan at garth.UUCP (Steven Ryan) writes:
> (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.

A little further though might show this idea to have some far-reaching
bad karma.  It would be very difficult to write a file system portable
across machines of varying architecture (i.e. Idris) if the compiler
on each machine can arbitrarily re-arrange structures to suit its own
whim.  This might start another `volatile' war :-) but it ain't good
for those who use C for what it was intended - systems programming :-).
-- 
  {uwmcsd1, hpda}!sp7040!obie!wes  | "If I could just be sick, I'd be fine."
	+1 801 825 3468	           |          -- Joe Housely --



More information about the Comp.lang.c mailing list