Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#4904 closed Bugs (invalid)

Comparison between signed and unsigned integer expressions

Reported by: sagimihaly+boost@… 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 anonymous, 12 years ago

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"?

comment:2 by Steven Watanabe, 12 years ago

Resolution: invalid
Status: newclosed

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.

comment:3 by anonymous, 8 years ago

This code is trying to cause a warning

Sabotage?

Note: See TracTickets for help on using tickets.