[Python-Dev] Problem with the memory docs

Martin v. Loewis martin@v.loewis.de
05 Apr 2002 20:18:35 +0200


Tim Peters <tim.one@comcast.net> writes:

> [Martin]
> > I think I'm now getting to the root of your confusion. Calling
> > malloc(1) is *not* what Guido wants. Instead, he wants that
> > py_malloc(0) returns a non-null pointer "normally".
> 
> And there's no better way to be 100% clear about what that means than to
> specify a trivial implementation that satisfies it.

There could be, but perhaps there isn't. Such an implementation is an
overspecification: If a platform already guarantees that malloc(0)
acts as if it was passed a non-zero argument, there is no need to pass
1; passing 1 may have undesirable side effects.

Regards,
Martin