removing default case requirement?
H. S. Teoh
hsteoh at qfbox.info
Fri Mar 31 20:46:18 UTC 2023
On Fri, Mar 31, 2023 at 11:20:41AM -0400, Steven Schveighoffer via Digitalmars-d wrote:
[...]
> But we have such a thing, in the `default:` case requirement.
>
> In my code, it happens quite a bit that I throw an exception in the
> default case, or return something, but there's still a lot of
> `default: break;` code in there.
[...]
> How much does this rule help you, vs. annoy you?
[...]
It annoys me. It's verbose and ugly. But OTOH, I'm also thankful for
it, because it has actually helped me catch bugs in my code on a few
occasions -- when I forgot to write the default case.
So I dunno, I'm on the fence about this. Maybe if there was a less
verbose way to indicate that the missing case was intentional?
T
--
Written on the window of a clothing store: No shirt, no shoes, no service.
More information about the Digitalmars-d
mailing list