On Jul 24, 2007, at 12:02 PM, Lisandro Dalcin wrote:
>> Per Lisandro's comments: I think that if you need a random/valid
>> value for an STL map (or similar), malloc(0) is not a good idea to
>> use as a key.
>
> OK, regarding comments in this thread, you are completelly right. I am
> fine with returning NULL.
>
> BTW, should'nt this issue be commented in the standard? Perhaps in the
> errata document? I think there is no a strong need to make it
> implementation dependent.
>
> MPI-2 could mandate/suggest that if size=0, the returned pointer is
> NULL, but then MPI_Free_mem with a NULL pointer should succeed.
Good point. Do you want to bring it up on the mpi-21 list?
> Now a question: What about Fortran ?
Hmm. Good question. I am not a Fortran expert, but my $0.02 would
be that if we can return NULL in C, and since there is no equivalent
to NULL in Fortran, then the result should be disallowed -- if you do
it, the results are undefined.
--
Jeff Squyres
Cisco Systems
|