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: Warning elimination patches in cp/call.c


Peter Schmid writes ...
> 
> +
> +       default:
> +         break;
> +               

Does this construct bother anyone else other than me?  In some cases,
it is certainly the correct behavior (when a small number of cases are
handled explicitly, and the rest should be ignored) but if added too
often, it makes the warning it fixes completely useless, since that
particular switch() will no longer _ever_ warn about unhandled cases.
I'd rather see patches that add "case <unhandled enum> : break" after
determining that the value in question really shouldn't be handled.
"default: break" should only be added when the number of "case x :
break" statements gets large.

---------------------------------------------------------------------------
Tim Hollebeek                           | "Everything above is a true
email: tim@wfn-shop.princeton.edu       |  statement, for sufficiently
URL: http://wfn-shop.princeton.edu/~tim |  false values of true."


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