[MPICH] null termination of MPI_Comm_get_name ?

Toon Knapen toon.knapen at fft.be
Thu Jul 12 04:02:00 CDT 2007


That is true. I had not looked at it that way.

Thanks,

toon

Rajeev Thakur wrote:
> Since that test itself is setting null-terminated names, it will get back
> null-terminated names. The only question is whether the pre-set name for
> MPI_COMM_SELF will be null-terminated. I think if you are calling
> MPI_Comm_get_name in C it would be.
>  
> Rajeev
> 
>> Date: Wed, 11 Jul 2007 17:52:11 +0200
>> From: Toon Knapen <toon.knapen at fft.be>
>> User-Agent: Thunderbird 1.5.0.12 (Windows/20070509)
>> Mime-Version: 1.0
>> To: mpich-discuss at mcs.anl.gov
>> Subject: [MPICH] null termination of MPI_Comm_get_name ?
>>
>> Hi all,
>>
>> In noticed that the test in test/mpi/comm/commname.c in mpich2-1.0.5p4 
>> compares what is returned by MPI_Comm_get_name (nameout) using the 
>> function 'strcmp'.
>>
>> However by using 'strcmp', the test relies on nameout[rlen] being a 
>> null-terminator.
>>
>> In my understanding of the standard however this is not the case. It is 
>> documented that the length of the name in C may only be 
>> MPI_MAX_OBJECT_NAME to be able to store the null terminator.
>>
>> So I would suggest to use 'strncmp' in the test. This has the extra 
>> advantage that the test also tests the rlen value that is returned by 
>> MPI_Comm_get_name (which is currently not the case).
>>
>> toon
>>
>>
> 
> 




More information about the mpich-discuss mailing list