Computed gotos on Reddit
Walter Bright
newshound2 at digitalmars.com
Mon Jul 23 15:06:06 PDT 2012
On 7/23/2012 2:25 PM, bearophile wrote:
> Walter Bright:
>
>> D already has it: http://dlang.org/statement.html#FinalSwitchStatement
>
> Do you have a proof? (Show me asm code)
Since the final switch does not allow a 'default' case, the check can be
omitted, and the generated code is a simple index-jump, just like the computed
goto example.
dmd currently doesn't do that, but that's not the language's fault, it's a
quality of implementation issue.
The point is, computed goto offers nothing that final switch doesn't.
More information about the Digitalmars-d
mailing list