Kaffe runs(!) under VC++

Daniel Veillard veillard at rufus.w3.org
Tue Nov 4 06:46:52 PST 1997

[Resent bounced message, Daniel.
 author: "T. Alexander Popiel" <popiel at pecan.snugharbor.com>]

In message:  <199711032351.XAA15795 at home.virtual-pc.com>
             "John D. Gwinner" <gwinner at northnet.org> writes:
>Ok -- that's different than a structure then; a structure layout is not
>defined by Ansi C.  I wasn't sure, thanks for jumping in!

Actually, structure layout is partially defined by ISO 9899-1990
(the international C spec) in section Structure and union

# Each non-bit-field member of a structure or union object is aligned
# in an implementation-defined manner appropriate to its type.
# Within a structure object, the non-bit-field members and the units
# in which bit-fields reside have addresses that increase in the order
# in which they are declared.  A pointer to a structure object,
# suitably converted, points to the initial member (or if that member
# is a bit-field, then to the unit in which it resides), and vice
# versa.  There may therefore be unnamed padding within a structure
# object, but not at its beginning, as necessary to achieve the
# appropriate alignment.


# There may also be unnamed padding at the end of a structure or union,
# as necessary to achieve the appropriate alignment were the structure
# or union to be an element of an array.

So, there's nothing (other than programmer outrage) to keep a compiler
from inserting arbitrary amounts of wasted space in structs, but other
than that, the struct layout is pretty firmly specified.  If you want
more info on the details of allocating bit-fields, then I suggest you
go read the spec yourself; the terms and conditions get rather hairy.

- Alex

More information about the kaffe mailing list