On Sun, Mar 21, 2010 at 06:11:43PM +0000, Jamie Lokier wrote:
> Michael S. Tsirkin wrote:
> > That's version 1 of my patch. Version 2 removed even need for macro
> > completely by moving allocations to the caller.
> 
> The downside of moving allocations are: (1) it's one more call in the
> caller, to allocate the type, (2) it needs a virtual destructor for
> each type to free the object, which can clutter the code if there is
> no other reason for virtual destructors.
> 
> I don't think those are necessarily bad, but they can remove from the
> neatness of existing code.  Personally I favour an occasional macro
> using sizeof/offsetof/container_of if the result is a natural and
> sensible API to all of its callers.
> 
> -- Jamie

We need to free in caller anyway because structure is used
after cleanup. This can be changed by restructuring code ...
I don't have a strong preference, anything is better
than the hack relying on field being at offset 0 in structure.

-- 
MST


Reply via email to