From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MBYUC-0003Dx-Cm for qemu-devel@nongnu.org; Tue, 02 Jun 2009 14:13:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MBYU7-000341-J4 for qemu-devel@nongnu.org; Tue, 02 Jun 2009 14:13:19 -0400 Received: from [199.232.76.173] (port=58512 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MBYU7-00033f-CD for qemu-devel@nongnu.org; Tue, 02 Jun 2009 14:13:15 -0400 Received: from mx20.gnu.org ([199.232.41.8]:57024) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MBYU7-0000VN-2z for qemu-devel@nongnu.org; Tue, 02 Jun 2009 14:13:15 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MBYU5-0004e6-UK for qemu-devel@nongnu.org; Tue, 02 Jun 2009 14:13:14 -0400 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH] use qemu_malloc and friends consistently Date: Tue, 2 Jun 2009 19:13:08 +0100 References: <200905290758.11551.jcd@tribudubois.net> <4A24D40E.2060704@redhat.com> <60cad3f0906021102o635b05f7m91593060683bb338@mail.gmail.com> In-Reply-To: <60cad3f0906021102o635b05f7m91593060683bb338@mail.gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906021913.09517.paul@codesourcery.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , David Turner , Gerd Hoffmann , Jean-Christophe Dubois > > QEMU_NEW_ARRAY(ptr, ...); > > > > instead of > > > > ptr = QEMU_NEW_ARRAY(...); > > > > then. I don't see another easy way to get the automagic sizeof(*ptr) > > stuff done though. > > The first version will extract the item size automatically for you, making > it less likely that you screw things in the second version's parameter > list. Not if you do it properly it won't. Implicit casts are only silently allowed between void* and arbitrary pointers. A cast between two arbitrary pointers will generate a compiler diagnostic. Paul