This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wswitch vs -Wuninitialized
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Subject: Re: -Wswitch vs -Wuninitialized
- From: Bo Thorsen <bo at sonofthor dot dk>
- Date: Mon, 20 Nov 2000 11:24:23 +0100 (CET)
- Cc: gcc at gcc dot gnu dot org
On Mon, 20 Nov 2000, Andrew Cagney wrote:
> ...
> code#3
> switch (ev)
> {
> case E_A: i = 1; break;
> case E_B: i = 2; break;
> default: abort (); /* bad switch */
> }
>
> the -Wuninitialized issue is addressed (GCC knows that all branches are
> covered). Unfortunatly, it also supresses the -Wswitch warning - which
> may still be a second bug.
How can it be a bug? All possible cases are covered so -Wswitch should be
happy (which it fortunately is). I can see that this is a matter of
personal taste, and I basically disagree with your interpretation of the
definition of the warning.
Bo.
--
Bo Thorsen
bo@sonofthor.dk
Lahnsgade 31, st.
DK-5000 Odense C
Tlf: +45 66 11 83 85
Rule one of good programmers: anything You can do, I can do better
Rule two of good programmers: anything I can do, You can do better
The Programming Theorem: anything worth doing is worth doing over and over again