Avoid can of worms testing minimum signed int value
Specifying the minimum 32 bit signed int value is not easily portable. Remove min_32bit_int2 method, min_32bit_int1 provides runtime coverage. g++ 32bit resulted in: warning: this decimal constant is unsigned only in ISO C90 and some versions of clang++ resulted in: error: integer literal is too large to be represented in type 'long' and is subject to undefined behavior under C++98, interpreting as 'unsigned long'; this literal will have type 'long long' in C++11 onwards [-Werror,-Wc++11-compat]
This commit is contained in:
parent
2c1a5c5919
commit
dcf8730cf3
2 changed files with 0 additions and 4 deletions
|
|
@ -31,7 +31,6 @@
|
|||
int max_32bit_int1(int a = 0x7FFFFFFF) { return a; }
|
||||
int max_32bit_int2(int a = 2147483647) { return a; }
|
||||
int min_32bit_int1(int a = -0x80000000) { return a; }
|
||||
int min_32bit_int2(int a = -2147483648) { return a; }
|
||||
long long too_big_32bit_int1(long long a = 0x80000000) { return a; }
|
||||
long long too_big_32bit_int2(long long a = 2147483648LL) { return a; }
|
||||
long long too_small_32bit_int1(long long a = -0x80000001) { return a; }
|
||||
|
|
|
|||
|
|
@ -148,9 +148,6 @@ def run(module_name):
|
|||
if tricky.max_32bit_int2() != 0x7FFFFFFF:
|
||||
print "max_32bit_int2 failed"
|
||||
tricky_failure = True
|
||||
if tricky.min_32bit_int2() != -2147483648:
|
||||
print "min_32bit_int2 failed"
|
||||
tricky_failure = True
|
||||
|
||||
tricky.too_big_32bit_int1()
|
||||
tricky.too_small_32bit_int1()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue