What is the use case for this weird switch mecanism

Philippe Sigaud philippe.sigaud at gmail.com
Tue Oct 30 10:47:21 PDT 2012


>> What the hell statement is supposed to do ? And what is the use case
>> for this ?
>
> That's weird. I just did a quick test; apparently statement is never
> run. I've no idea why it's allowed or what it's for.

I've no idea why it's authorized, but it saved my day a week ago, in
an automatically-generated switch statement that happened to have a
"return true;" inserted at the very beginning. No unit test found that
and I saw it only by printing the generated code for another search.

In a way, it's logical: the code path jumps to the matching case, so
it never sees the first statement block before the first case.


More information about the Digitalmars-d mailing list