[mpich-discuss] Is MPI_SUCCESS == 0 mandated by the standard?

Rajeev Thakur thakur at mcs.anl.gov
Thu Jan 21 15:12:43 CST 2010


Yes, see pg 283, ln 23 of the MPI 2.2 standard.

"The error codes satisfy,
0 = MPI_SUCCESS < MPI_ERR_...  MPI_ERR_LASTCODE:

Rationale. 
...
Note that MPI_SUCCESS = 0 is necessary to be consistent with C practice; 
"

Rajeev

> -----Original Message-----
> From: mpich-discuss-bounces at mcs.anl.gov 
> [mailto:mpich-discuss-bounces at mcs.anl.gov] On Behalf Of Rhys Ulerich
> Sent: Thursday, January 21, 2010 3:06 PM
> To: mpich-discuss at mcs.anl.gov
> Subject: [mpich-discuss] Is MPI_SUCCESS == 0 mandated by the standard?
> 
> Hi all,
> 
> >From peeking at mpich's headers, I can see that MPI_SUCCESS 
> is defined
> to be zero.  Is this mandated by the specification?  Or is 
> this just the glaringly obvious value to choose for the C binding?
> 
> I ask because stylistically I'd love to write
> 
> int error = MPI_Something(...);
> if (error) {
>   // Handle error
> }
> 
> instead of
> 
> int status = MPI_Something(...);
> if (status != MPI_SUCCESS) {
>    // Handle error
> }
> 
> I have looked but have been unable to find a part of the 
> specification that discusses the specific value of 
> MPI_SUCCESS for C bindings.
> 
> Thanks,
> Rhys
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> 



More information about the mpich-discuss mailing list