What is the use case for this weird switch mecanism

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Oct 30 10:09:25 PDT 2012


On Tue, Oct 30, 2012 at 05:16:48PM +0100, deadalnix wrote:
> Today, I noticed by digging into D details the following construct :
> 
> switch(foo) {
>     statement;
>     case A:
>         // Stuffs . . .
> 
>     // Other cases.
>     default:
>         // Stuffs . . .
> }
> 
> 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.


T

-- 
Debian GNU/Linux: Cray on your desktop.


More information about the Digitalmars-d mailing list