Open
Bug 552788
Opened 15 years ago
Updated 2 years ago
Fix compile warnings in TestStrings.cpp: "this decimal constant is unsigned only in ISO C90" / "integer constant is so large that it is unsigned"
Categories
(Core :: XPCOM, defect)
Tracking
()
NEW
People
(Reporter: dholbert, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [build_warning])
When building TestStrings.cpp, I get:
> xpcom/tests/TestStrings.cpp:697: warning: this decimal constant is unsigned only in ISO C90
> xpcom/tests/TestStrings.cpp:697: warning: this decimal constant is unsigned only in ISO C90
> xpcom/tests/TestStrings.cpp:700:41: warning: integer constant is so large that it is unsigned
> xpcom/tests/TestStrings.cpp:700: warning: this decimal constant is unsigned only in ISO C90
> xpcom/tests/TestStrings.cpp:700:228: warning: integer constant is so large that it is unsigned
> xpcom/tests/TestStrings.cpp:700: warning: this decimal constant is unsigned only in ISO C90
The blamed lines are:
> 697 test_appends(-2147483648, L)
and
> 700 test_appends(-9223372036854775808, LL)
(which, after expanding macros, will end up appending the "L" and "LL" to the numeric values)
These are the minimum 32-bit and 64-bit signed integer values.
According to the second post on this thread...
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/4f5ed69b31fd5e1e
...the problem is that, in "-2147483648", the "-" and the "2147483648" are evaluated separately. And 2147483648 isn't a valid signed integer. (it's too large by 1)
Can we work around this somehow? i.e. Perhaps we could test -MAX_VALUE rather than MIN_VALUE in these cases? (so that the MAX_VALUE on its own, separate from the "-", doesn't freak out the compiler)
Comment 1•15 years ago
|
||
The original test used PRInt64 min = LL_MinInt(), I assume that this was chosen to ensure that the entire range was tested.
Would using a cast instead of an assignment help?
Updated•13 years ago
|
Whiteboard: [build_warning]
Updated•13 years ago
|
Blocks: buildwarning
Assignee | ||
Updated•4 years ago
|
Component: String → XPCOM
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•