switch()

Walter Bright newshound2 at digitalmars.com
Mon Feb 17 15:01:38 PST 2014


On 2/17/2014 2:43 PM, Ary Borenszweig wrote:
> Now suppose bit_flag can get an additional "new_bit_flag" value. How does
> "default" helps me notice that I'm supposed to add it to that switch statement?

Because if you account for all the cases, you write:

    default: assert(0);

Now you intentionally tell the user that you intentionally covered all the cases.


More information about the Digitalmars-d mailing list