Missing default in switch

Keith Thompson kst@cts.com
Tue Oct 19 03:44:00 GMT 1999


Alex Vinokur <alexander.vinokur@telrad.co.il> writes:
> Is there any possibility to make a compiler protest
> against missing default-word in switch-statement?

Since a switch statement without a default label is a perfectly legal
construct with well-defined semantics, presumably this would be at
most a warning, at least in conforming mode.  Compilers can issue
warnings for anything they want.  I don't know of any that warn about
this particular construct.  (In the case of gcc, you could of course
modify the sources to add such a warning yourself.)

Since this doesn't seem to be a standards question, I'll redirect
followups away from comp.std.c.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  < http://www.ghoti.net/~kst >
San Diego Supercomputer Center           <*>  < http://www.sdsc.edu/~kst >
"Oh my gosh!  You are SO ahead of your time!" -- anon.


More information about the Gcc-help mailing list