Inside the switch statement

Ellery Newcomer ellery-newcomer at utulsa.edu
Mon Jun 8 22:39:57 PDT 2009


BCS wrote:
> Hello Sam,
> 
>> To save time ,just get to my point:I do not understand why such code
>> below inside the switch ... case statement is allowed ,what is the
>> point of do ... while...:
> 
> This is a classic C thing. The short explanation is that a switch is a
> conditional, many way goto and the labels can be *anywhere* in the body
> (except inside another switch). For the more in depth version Google
> "duff's device".
> 
>>
>> This example uses a mixin to implement a generic Duff's device for an
>> arbitrary statement (in this case, the arbitrary statement is in
>> bold).
> 
> BTW: where is this from?

I would guess from the D specs

http://www.digitalmars.com/d/1.0/template-mixin.html


More information about the Digitalmars-d-learn mailing list