This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: -Wswitch vs -Wuninitialized


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]