This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Rename -W to -Wextra ?
On Monday, 03 June 2002 23:35, Phil Edwards wrote:
> On Mon, Jun 03, 2002 at 11:52:28AM +0100, Joseph S. Myers wrote:
> >
> > Can you split -W into separate options for the separate things it
> > controls, the way -Wall is just the union of such separate options?
>
> [snip]
>
> That's 20 separate options. And remember that they are for corner
> cases, so we'd end up with -Wunsigned-compared-against-zero-with-<
> and -Wempty-if-body and
> -Wsubscripting-an-array-declared-as-register...
As a C++ programmer, I would _love_ to be able to turn that first one
off without losing the rest of -W. I could point to any number of
places in my code where I tried to make a template that would work for
both signed and unsigned types, and had to resort to convoluted code to
avoid that particular warning.
E.g. obvious code that g++ -W -Wall -Werror rejects:
template <typename T> T absolute(T t) {
if (t < T(0))
return -t;
else
return t;
}
Gratuitous complexity to shut gcc up:
template <typename T> T absolute(T t) {
if (t > T(0))
return t;
else if (t == T(0))
return t;
else
return -t;
}
--
Ross Smith ..................................... Auckland, New Zealand
r-smith@ihug.co.nz ...................................................
"Never underestimate the power of stupid things in large numbers."
-- Serious Sam