warning: comparison is always false due to limited range of data type [-Wtype-limits]
JonasBreuling opened this issue · comments
On windows compiling the example
// indicators_issue.cpp
#include <indicators/progress_bar.hpp>
int main()
{
int n = 100;
indicators::ProgressBar pbar{
indicators::option::MaxProgress{n},
};
for (int i = 0; i < n; ++i) {
pbar.tick();
}
return 0;
}
compiling with gcc.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 10.3.0
I get the following annoying warnings:
In file included from C:/project/build/_deps/indicators_git-src/include/indicators/details/stream_helper.hpp:5,
from C:/project/build/_deps/indicators_git-src/include/indicators/progress_bar.hpp:5,
from C:\project\examples\indicators_issue.cpp:1:
C:/project/build/_deps/indicators_git-src/include/indicators/display_width.hpp: In function 'int unicode::details::mk_wcwidth(wchar_t)':
C:/project/build/_deps/indicators_git-src/include/indicators/display_width.hpp:201:57: warning: comparison is always false due to limited range of data type [-Wtype-limits]
201 | (ucs >= 0xffe0 && ucs <= 0xffe6) || (ucs >= 0x20000 && ucs <= 0x2fffd) ||
| ~~~~^~~~~~~~~~
C:/project/build/_deps/indicators_git-src/include/indicators/display_width.hpp:201:75: warning: comparison is always true due to limited range of data type [-Wtype-limits]
201 | (ucs >= 0xffe0 && ucs <= 0xffe6) || (ucs >= 0x20000 && ucs <= 0x2fffd) ||
| ~~~~^~~~~~~~~~
C:/project/build/_deps/indicators_git-src/include/indicators/display_width.hpp:202:21: warning: comparison is always false due to limited range of data type [-Wtype-limits]
202 | (ucs >= 0x30000 && ucs <= 0x3fffd)));
| ~~~~^~~~~~~~~~
C:/project/build/_deps/indicators_git-src/include/indicators/display_width.hpp:202:39: warning: comparison is always true due to limited range of data type [-Wtype-limits]
202 | (ucs >= 0x30000 && ucs <= 0x3fffd)));
Can these comparisons be removed?