On Jul 24, 2007, at 8:28 AM, Gleb Natapov wrote:

On Tue, Jul 24, 2007 at 11:20:11AM -0300, Lisandro Dalcin wrote:
On 7/23/07, Jeff Squyres <jsquy...@cisco.com> wrote:
Does anyone have any opinions on this?  If not, I'll go implement
option #1.

Sorry, Jeff... just reading this. I think your option #1 is the
better. However, I want to warn you about to issues:

* In my Linux FC6 box, malloc(0) return different pointers for each
call. In fact, I believe this is a requeriment for malloc, in the case
man malloc tells me this:
"If size was equal to 0, either NULL or a pointer suitable to be passed to free() is returned". So may be we should just return NULL and be done with it?

Which is also what POSIX says:

  http://www.opengroup.org/onlinepubs/009695399/functions/malloc.html

I vote with gleb -- return NULL, don't set errno, and be done with it. The way I read the advice to implementors, this would be a legal response to a 0 byte request.

Brian

Reply via email to