From 534f955827739755d705f97de402b20b2148879c Mon Sep 17 00:00:00 2001 From: Peter Meerwald-Stadler Date: Tue, 28 Jun 2022 18:19:56 +0200 Subject: [PATCH] error: fix warning, signedness of comparison MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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)))); --- src/error.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/error.cpp b/src/error.cpp index 1415bbe..710ef6d 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -1,6 +1,7 @@ #include "error.hpp" #include +#include namespace cmkr { namespace error { @@ -20,6 +21,6 @@ static const char *err_string[] = { }; const char *cmkr_error_status(int i) { - assert(i >= 0 && i < (sizeof(err_string) / sizeof(*(err_string)))); + assert(i >= 0 && static_cast(i) < (sizeof(err_string) / sizeof(*(err_string)))); return err_string[i]; }