#4904 closed Bugs (invalid)
Comparison between signed and unsigned integer expressions
Reported by: | Owned by: | Aleksey Gurtovoy | |
---|---|---|---|
Milestone: | To Be Determined | Component: | mpl |
Version: | Boost 1.45.0 | Severity: | Cosmetic |
Keywords: | Cc: |
Description
Compiling with g++ 4.4, I get the following warning:
/boost/mpl/print.hpp:55: warning: comparison between signed and unsigned integer expressions
the expression is
sizeof(T) > -1
Is there a specific reason for not using
sizeof(T) >= 0
instead?
Change History (3)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
This code is trying to cause a warning, so it's doing exactly what it's supposed to. Look at the template instantiation backtrace to figure out why.
Note:
See TracTickets
for help on using tickets.
I think that making this change would merely replace one warning for another. In particular, it would say "result of expression is always true" or something like that; since for any T sizeof (T) is >= 0 (or, if T is incomplete, is a compile error).
A better question is "What is this code trying to accomplish"?