On 01/31/2012 03:51 PM, Jan Kiszka wrote:
>
> BTW, this is yet another benefit of making structures public. You can take
the
> address of a child and set link fields directly without accessors.
Well, that has two sides. We introduced properties to avoid this direct
messing.
Does linking also work without exposing internals?
Perhaps it doesn't need to expose internals. Just like we create
interfaces automatically when creating a parent object, perhaps we can
create children as well, like
TypeInfo type_piix3 = {
...
.children = {
{ "pic[0]", TYPE_I8259, offsetof(PIIX3, pic[0]) },
{ "pic[1]", TYPE_I8259, offsetof(PIIX3, pic[1]) },
{ "pit, TYPE_I8254, offsetof(PIIX3, pit) },
{ "rtc", TYPE_RTC, offsetof(PIIX3, rtc) },
{ }
}
}
QOM's object_init would allocate a single malloced block for all of
them, carve out space for the parent and all children, and add the
properties.
Paolo