From 19b996e745719886594c13cbe6bf3a1e5937e221 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 27 Oct 2020 00:20:01 +0100 Subject: [PATCH] Use std::vector. --- src/smpi/bindings/smpi_pmpi.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index 66346e8e01..658d06ec29 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -209,9 +209,8 @@ int PMPI_Error_class(int errorcode, int* errorclass) { 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) + static const std::vector smpi_error_string = {FOREACH_ERROR(GENERATE_STRING)}; + if (errorcode < 0 || static_cast(errorcode) >= smpi_error_string.size() || string == nullptr) return MPI_ERR_ARG; int len = snprintf(string, MPI_MAX_ERROR_STRING, "%s", smpi_error_string[errorcode]); -- 2.20.1