Re: [Qemu-devel] [PATCH v9 05/17] qapi: Unbox base members

2015-10-22 Thread Markus Armbruster
Eric Blake writes: > On 10/21/2015 07:34 AM, Markus Armbruster wrote: > >> >> The least verbose naming convention for a conversion function I can >> think of right now is TBase(), where T is the name of a type with a >> base. Compare: >> >> foo((Parent *)child, blah) >> foo(ChildBase(c

Re: [Qemu-devel] [PATCH v9 05/17] qapi: Unbox base members

2015-10-22 Thread Eric Blake
On 10/21/2015 07:34 AM, Markus Armbruster wrote: > > The least verbose naming convention for a conversion function I can > think of right now is TBase(), where T is the name of a type with a > base. Compare: > > foo((Parent *)child, blah) > foo(ChildBase(child), blah) > > Tolerable? W

Re: [Qemu-devel] [PATCH v9 05/17] qapi: Unbox base members

2015-10-21 Thread Markus Armbruster
Eric Blake writes: > On 10/21/2015 07:34 AM, Markus Armbruster wrote: > > @@ -218,9 +216,11 @@ static void channel_event(int event, > SpiceChannelEventInfo *info) > } > > if (info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) { > -add_addr_info(client->base

Re: [Qemu-devel] [PATCH v9 05/17] qapi: Unbox base members

2015-10-21 Thread Markus Armbruster
Eric Blake writes: > On 10/20/2015 06:09 AM, Markus Armbruster wrote: >> Eric Blake writes: >> >>> Rather than storing a base class as a pointer to a box, just >>> store the fields of that base class in the same order, so that >>> a child struct can be safely cast to its parent. > > > >>>

Re: [Qemu-devel] [PATCH v9 05/17] qapi: Unbox base members

2015-10-21 Thread Eric Blake
On 10/21/2015 07:34 AM, Markus Armbruster wrote: @@ -218,9 +216,11 @@ static void channel_event(int event, SpiceChannelEventInfo *info) } if (info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) { -add_addr_info(client->base, (struct sockaddr *)&info->pa

Re: [Qemu-devel] [PATCH v9 05/17] qapi: Unbox base members

2015-10-20 Thread Eric Blake
On 10/20/2015 06:09 AM, Markus Armbruster wrote: > Eric Blake writes: > >> Rather than storing a base class as a pointer to a box, just >> store the fields of that base class in the same order, so that >> a child struct can be safely cast to its parent. >> Compare to the earlier commit 1e6

Re: [Qemu-devel] [PATCH v9 05/17] qapi: Unbox base members

2015-10-20 Thread Markus Armbruster
Eric Blake writes: > Rather than storing a base class as a pointer to a box, just > store the fields of that base class in the same order, so that > a child struct can be safely cast to its parent. This gives > less malloc overhead, less pointer dereferencing, and even less > generated code. Lo

[Qemu-devel] [PATCH v9 05/17] qapi: Unbox base members

2015-10-15 Thread Eric Blake
Rather than storing a base class as a pointer to a box, just store the fields of that base class in the same order, so that a child struct can be safely cast to its parent. This gives less malloc overhead, less pointer dereferencing, and even less generated code. Without boxing, the corner case o