From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 29 17:23:18 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3BF0F16A53C for ; Thu, 29 Jun 2006 17:23:18 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from smtp-3.dlr.de (smtp-3.dlr.de [195.37.61.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 41AE744098 for ; Thu, 29 Jun 2006 16:53:36 +0000 (GMT) (envelope-from Hartmut.Brandt@dlr.de) Received: from beagle.kn.op.dlr.de ([129.247.173.6]) by smtp-3.dlr.de over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830); Thu, 29 Jun 2006 18:53:35 +0200 Date: Thu, 29 Jun 2006 18:53:34 +0200 (CEST) From: Harti Brandt X-X-Sender: brandt_h@beagle.kn.op.dlr.de To: Johannes Weiner In-Reply-To: <20060629162319.GA94921@leiferikson.flosken.lan> Message-ID: <20060629185249.C55888@beagle.kn.op.dlr.de> References: <20060628181045.GA54915@curry.mchp.siemens.de> <20060629054222.GA92895@leiferikson.flosken.lan> <20060629162319.GA94921@leiferikson.flosken.lan> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 29 Jun 2006 16:53:35.0051 (UTC) FILETIME=[8F72D9B0:01C69B9C] Cc: freebsd-hackers@freebsd.org Subject: Re: Return value of malloc(0) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Harti Brandt List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jun 2006 17:23:18 -0000 On Thu, 29 Jun 2006, Johannes Weiner wrote: JW>On Thu, Jun 29, 2006 at 06:09:37PM +0200, Matthias Andree wrote: JW> JW>> The value returned from malloc(0) must not be dereferenced whatever it JW>> was. It was 0x800, which doesn't count as "failure". JW> JW>But this would be appropriate for catching the error: JW> JW>if ((foo = malloc(0)) == foo) JW> /* make noise */ JW> JW>wouldn't it? Wouldn't it rather invoke undefined behaviour? harti