Date: Thu, 29 Jun 2006 15:33:08 -0400 From: Pat Lashley <patl+freebsd@volant.org> To: joerg@britannica.bec.de, freebsd-hackers@freebsd.org Subject: Re: Return value of malloc(0) Message-ID: <F08E3BAE0BDAC4061A2A283F@Zelazny> In-Reply-To: <20060629165629.GA6875@britannica.bec.de> References: <20060628181045.GA54915@curry.mchp.siemens.de> <20060628212956.GI822@wombat.fafoe.narf.at> <805AA34B676EDF411B3CF548@Zelazny> <20060629165629.GA6875@britannica.bec.de>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Thu, Jun 29, 2006 at 11:44:23AM -0400, Pat Lashley wrote: > > No, our implementation is NOT legal. We always return the SAME value. To > > be legal, we should not return that value again unless it has been > > free()-ed. > > It is legal due to brain damaged definition of implementation defined > behaviour, but it violates the spirit of the standard :-) Perhaps I'm misunderstanding the 'implementation defined behavior' choices in the standard. I thought that it could either 1) Return NULL; or 2) Behave as though it returned a 'minimum allocation' (which cannot be legally de-referenced). But if it did actually perform a 'minimum allocation'; wouldn't it have to return a different value every time to maintain the free() semantics? -Pat
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F08E3BAE0BDAC4061A2A283F>