From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH] Introduce QEMU_NEW() Date: Mon, 25 Jul 2011 11:32:29 +0200 Message-ID: References: <1311583872-362-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from cantor2.suse.de ([195.135.220.15]:36832 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507Ab1GYJcl (ORCPT ); Mon, 25 Jul 2011 05:32:41 -0400 In-Reply-To: <1311583872-362-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 25.07.2011, at 10:51, Avi Kivity wrote: > qemu_malloc() is type-unsafe as it returns a void pointer. Introduce > QEMU_NEW() (and QEMU_NEWZ()), which return the correct type. What does this buy you over type *x = qemu_malloc(sizeof(type)); ? I find the non-C++ version easier to read even. Alex From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlHWl-0001fi-GK for qemu-devel@nongnu.org; Mon, 25 Jul 2011 05:32:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QlHWk-0001e1-N7 for qemu-devel@nongnu.org; Mon, 25 Jul 2011 05:32:43 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36833 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlHWk-0001di-GQ for qemu-devel@nongnu.org; Mon, 25 Jul 2011 05:32:42 -0400 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <1311583872-362-1-git-send-email-avi@redhat.com> Date: Mon, 25 Jul 2011 11:32:29 +0200 Content-Transfer-Encoding: 7bit Message-Id: References: <1311583872-362-1-git-send-email-avi@redhat.com> Subject: Re: [Qemu-devel] [PATCH] Introduce QEMU_NEW() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org On 25.07.2011, at 10:51, Avi Kivity wrote: > qemu_malloc() is type-unsafe as it returns a void pointer. Introduce > QEMU_NEW() (and QEMU_NEWZ()), which return the correct type. What does this buy you over type *x = qemu_malloc(sizeof(type)); ? I find the non-C++ version easier to read even. Alex