On Jan 16, 2009, at 1:15 PM, Chris Lattner wrote:

> On Jan 16, 2009, at 12:50 PM, Douglas Gregor wrote:
>>>> My complaint about putting a default: in there still stands: it  
>>>> suppresses a useful warning, where we've omitted a case, and  
>>>> turns it into a run-time failure.
>>>
>>> Does GCC produce a warning for cases like:
>>>
>>> int foo() {
>>> switch (someenum) {
>>> case <all possible enums>:
>>>  return 0;
>>> }
>>> // no return
>>> }
>>>
>>> About falling off the end of the function?
>>
>> Yeah, it does.
>
> That's bad.  Can we just use default: assert(0) in those cases?


That turns off the warning in the case where you've done:

        switch (someenum) {
        case <all possible enums except the new one someone else added>:
                do something;
        };

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to