On Wed, May 10, 2006 at 12:30:33PM -0400, Andrew Pinski wrote:
> > I think that the warning is useful if the comparison is *always* true for
> > any call of foo. But here, whether the test is redundant or not
> > depends on the type of bar. Possibly there's a way to determine that the
> > type of
On 10/05/06, Joe Buck <[EMAIL PROTECTED]> wrote:
But then I just thought of another case:
template
struct foo {
foo(const Container& bar) { if (bar.size() >= 0) use(bar); }
};
For any STL-compliant container the test is redundant. But if
we put in a rule saying to suppress the warning if
>
>
> Aliesha Finkel <[EMAIL PROTECTED]> writes:
> > | Hi, I'm using -Wextra (-W) to compile my code, one
> > | feature of which is throwing a warning when an
> > | unsigned type is checked for >= 0 since it's always
> > | true. In general I find this to be very helpful, but
> > | it throws this
Joe Buck <[EMAIL PROTECTED]> writes:
[...]
| class C {
| public:
| int size() const;
many people, including "dinosaure" C++ users, wish the standard containers
did not have unsigned return type for size().
-- Gaby
Joe Buck <[EMAIL PROTECTED]> writes:
| Aliesha Finkel <[EMAIL PROTECTED]> writes:
| > | Hi, I'm using -Wextra (-W) to compile my code, one
| > | feature of which is throwing a warning when an
| > | unsigned type is checked for >= 0 since it's always
| > | true. In general I find this to be very h
Aliesha Finkel <[EMAIL PROTECTED]> writes:
> | Hi, I'm using -Wextra (-W) to compile my code, one
> | feature of which is throwing a warning when an
> | unsigned type is checked for >= 0 since it's always
> | true. In general I find this to be very helpful, but
> | it throws this error even for t
Aliesha Finkel <[EMAIL PROTECTED]> writes:
| Hi, I'm using -Wextra (-W) to compile my code, one
| feature of which is throwing a warning when an
| unsigned type is checked for >= 0 since it's always
| true. In general I find this to be very helpful, but
| it throws this error even for templated t
On 10/05/06, Aliesha Finkel <[EMAIL PROTECTED]> wrote:
template
struct foo {
foo(T bar) { if (bar >= 0) bar = 1; }
};
If foo is instantiated elsewhere then
this check could still be useful.
My opinion is that since it may be instantiated as an signed type,
then warning is pointless there.