This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-Wextra and unsigned template parameters
- From: Aliesha Finkel <agfinkel at yahoo dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 9 May 2006 19:39:19 -0700 (PDT)
- Subject: -Wextra and unsigned template parameters
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 types. A code
example is included below. Does anyone know how best
to supress this warning without resorting to removing
the condition or turning off -Wextra? Thank you in
advance.
template <typename T>
struct foo {
foo(T bar) { if (bar >= 0) bar = 1; }
};
If foo<signed type> is instantiated elsewhere then
this check could still be useful.
I apologize in advance if this question is better
suited to gcc-help. I tried there, and not having
gotten an answer I fear it may be a defect in -Wextra
so I took it up here.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com