From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtPcr-0005DE-2s for qemu-devel@nongnu.org; Sun, 21 Mar 2010 14:11:49 -0400 Received: from [199.232.76.173] (port=44325 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtPcq-0005Cp-Oh for qemu-devel@nongnu.org; Sun, 21 Mar 2010 14:11:48 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NtPcp-00033Z-Lf for qemu-devel@nongnu.org; Sun, 21 Mar 2010 14:11:48 -0400 Received: from mail2.shareable.org ([80.68.89.115]:49771) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NtPcp-00033N-DA for qemu-devel@nongnu.org; Sun, 21 Mar 2010 14:11:47 -0400 Date: Sun, 21 Mar 2010 18:11:43 +0000 From: Jamie Lokier Subject: Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups Message-ID: <20100321181143.GE4174@shareable.org> References: <20100318064015.GA16973@redhat.com> <20100318074239.GA23474@redhat.com> <20100318090711.GB23649@redhat.com> <20100319014159.GB14108@shareable.org> <20100321143103.GD12758@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100321143103.GD12758@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, Juan Quintela 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