21.3.3. Handle Constants

PreviousUpNext
Up: The C Application Binary Interface Next: Integer Constants Previous: Opaque Handles

Every handle type has at least one, and often many, predefined constants of that type, e.g., MPI_REQUEST_NULL for MPI_Request and MPI_COMM_WORLD for MPI_Comm. The MPI ABI defines handle constants to be compile-time constants, which are specified as integer expressions cast to the appropriate handle type.


Rationale.

Link-time constants, while convenient, are not strictly portable. ( End of rationale.)
All predefined handle constants correspond to integer representations that are unlikely to be valid addresses, and must not be dereferenced. Implementations must ensure that the handles they create for the user are never in the range reserved for predefined handle constants. The MPI ABI reserves values corresponding to the integers 1 to 4095 for predefined handle constants. The definition of these constants is described in Section Handle Constants. Handle arguments with an integer representation of zero are never valid handles.


Rationale.

Many operating systems support a ``zero page'' that corresponds to the above address range, in which case, implementations will not need to do any runtime checking to ensure the above requirement is satisfied. Ensuring that an integer representation of zero is never a legal handle argument allows the detection of uninitialized data, which may lead to undefined behavior. ( End of rationale.)
All of the constants are specified in Section Defined Constants.


PreviousUpNext
Up: The C Application Binary Interface Next: Integer Constants Previous: Opaque Handles


Return to MPI-5.0 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-5.0 of June 9, 2025
HTML Generated on March 2, 2025