Use std mechanism to detect signedness

This commit is contained in:
Dmitry-Me 2017-08-11 18:44:14 +03:00
parent 465c86faa7
commit 45032f7d3b
1 changed files with 2 additions and 2 deletions

View File

@ -22,6 +22,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <limits>
cppcheck::Platform::Platform() cppcheck::Platform::Platform()
{ {
@ -56,8 +57,7 @@ bool cppcheck::Platform::platform(cppcheck::Platform::PlatformType type)
if (type == Unspecified) { if (type == Unspecified) {
defaultSign = '\0'; defaultSign = '\0';
} else { } else {
char x = -1; defaultSign = (std::numeric_limits<char>::is_signed) ? 's' : 'u';
defaultSign = (x < 0) ? 's' : 'u';
} }
char_bit = 8; char_bit = 8;
short_bit = char_bit * sizeof_short; short_bit = char_bit * sizeof_short;