Set errno when out of range in strtoimax (#111)
This commit is contained in:
@ -443,7 +443,7 @@ bool ConsumeLiteral(const char *literal) {
|
||||
char *e;
|
||||
struct Value x;
|
||||
x.t = kInt;
|
||||
x.i = strtoimax(literal, &e, 0);
|
||||
x.i = *literal == '-' ? strtoimax(literal, &e, 0) : strtoumax(literal, &e, 0);
|
||||
if (!e || *e) {
|
||||
x.t = kFloat;
|
||||
x.f = strtod(literal, &e);
|
||||
|
||||
@ -81,3 +81,11 @@ false false || ! assert
|
||||
1 -1 min -1 = assert
|
||||
1 2 min 1 = assert
|
||||
rand64 rand64 rand64 rand64 != != && assert
|
||||
|
||||
# HEX SIGN
|
||||
-0x80000000 -2147483648 = assert
|
||||
0x80000000 2147483648 = assert
|
||||
0x80000001 2147483649 = assert
|
||||
0xffffffff 4294967295 = assert
|
||||
0x100000000 4294967296 = assert
|
||||
-0x100000000 -4294967296 = assert
|
||||
|
||||
Reference in New Issue
Block a user