Skip to content

Commit 534f955

Browse files
committed
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))));
1 parent ef537ce commit 534f955

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/error.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "error.hpp"
22

33
#include <cassert>
4+
#include <cstddef>
45

56
namespace cmkr {
67
namespace error {
@@ -20,6 +21,6 @@ static const char *err_string[] = {
2021
};
2122

2223
const char *cmkr_error_status(int i) {
23-
assert(i >= 0 && i < (sizeof(err_string) / sizeof(*(err_string))));
24+
assert(i >= 0 && static_cast<size_t>(i) < (sizeof(err_string) / sizeof(*(err_string))));
2425
return err_string[i];
2526
}

0 commit comments

Comments
 (0)