-int PMPI_Error_string(int errorcode, char* string, int* resultlen){
- if (errorcode<0 || errorcode>= MPI_MAX_ERROR_STRING || string ==nullptr){
+int PMPI_Error_string(int errorcode, char* string, int* resultlen)
+{
+ static const char* smpi_error_string[] = {FOREACH_ERROR(GENERATE_STRING)};
+ constexpr int nerrors = (sizeof smpi_error_string) / (sizeof smpi_error_string[0]);
+ if (errorcode < 0 || errorcode >= nerrors || string == nullptr)