error: fix warning, signedness of comparison

cmkr/src/error.cpp:23:24: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
   23 |     assert(i >= 0 && i < (sizeof(err_string) / sizeof(*(err_string))));
main
Peter Meerwald-Stadler 2 years ago
parent ef537ce084
commit 534f955827

@ -1,6 +1,7 @@
#include "error.hpp" #include "error.hpp"
#include <cassert> #include <cassert>
#include <cstddef>
namespace cmkr { namespace cmkr {
namespace error { namespace error {
@ -20,6 +21,6 @@ static const char *err_string[] = {
}; };
const char *cmkr_error_status(int i) { const char *cmkr_error_status(int i) {
assert(i >= 0 && i < (sizeof(err_string) / sizeof(*(err_string)))); assert(i >= 0 && static_cast<size_t>(i) < (sizeof(err_string) / sizeof(*(err_string))));
return err_string[i]; return err_string[i];
} }

Loading…
Cancel
Save