switch()

Ary Borenszweig ary at esperanto.org.ar
Mon Feb 17 05:48:01 PST 2014


On 2/16/14, 5:03 PM, Walter Bright wrote:
> On 2/16/2014 7:42 AM, Manu wrote:
>> 3. Why is 'default' necessary? If I'm not switching on an enumerated
>> type, then
>> many values are meaningless. requiring an empty 'default: break;' line
>> at the
>> end is annoying and noisy.
>
> It originally was not required, but there was a campaign by a lot of D
> users to make it required to deal with the common bug of adding a value
> in one switch statement but forgetting to add it to another
> corresponding one.

Could you show an example of such scenario? I don't get it.


More information about the Digitalmars-d mailing list