I agree with Gleb. Calling malloc with size 0 is just bad practice.
As the returned memory is not supposed to be suitable for any use
[fact that we can not verify as there is at least one byte] why
returning anything else than NULL ? Returning NULL will make the
application segfault, which is a good hint for the user that
something wasn't right somewhere. Moreover, returning some special
memory will force us to check in most MPI functions that this
particular pointer is not used [similar to MPI_BOTTOM], which is a
huge amount of code.
george.
On Jul 24, 2007, at 10: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?
--
Gleb.
_______________________________________________
devel mailing list
de...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel