From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MA2ZX-000465-Nn for qemu-devel@nongnu.org; Fri, 29 May 2009 09:56:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MA2ZS-00044r-BK for qemu-devel@nongnu.org; Fri, 29 May 2009 09:56:34 -0400 Received: from [199.232.76.173] (port=52305 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MA2ZS-00044o-6f for qemu-devel@nongnu.org; Fri, 29 May 2009 09:56:30 -0400 Received: from mx2.redhat.com ([66.187.237.31]:34678) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MA2ZR-0004zu-LA for qemu-devel@nongnu.org; Fri, 29 May 2009 09:56:29 -0400 Date: Fri, 29 May 2009 10:59:59 -0300 From: Glauber Costa Subject: Re: [Qemu-devel] [PATCH] use qemu_malloc and friends consistently Message-ID: <20090529135959.GA8897@poweredge.glommer> References: <200905290758.11551.jcd@tribudubois.net> <4A1FD6E2.9020006@redhat.com> <200905291407.26757.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200905291407.26757.paul@codesourcery.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: Kevin Wolf , Jean-Christophe Dubois , qemu-devel@nongnu.org, Gerd Hoffmann > To some extent the answer to this question depends how much you trust your > programmers. If you assume everyone knows the C standard well and always > writes perfect code then malloc(0) is a legitimate technique, though IMHO of > fairly limited benefit. > > If you want maximize chances of catching accidental mistakes as early as > possible then you should have malloc(0) abort, because it probably means > someone forgot tho consider the empty case. > If we have to start programming like this because we don't trust our programmers, (ultimately, ourselves), then we're pretty much doomed. If anyone is contributing code to qemu these days, chances are that his code will get reviewed. We'll then spot those things and kick them out. That's the only reasonable way to get quality.