Computed gotos on Reddit

Alex Rønne Petersen alex at lycus.org
Mon Jul 23 01:13:31 PDT 2012


On 23-07-2012 05:05, deadalnix wrote:
> On 23/07/2012 01:35, bearophile wrote:
>> A discussion appeared few days ago on Reddit, about computed gotos:
>>
>> http://www.reddit.com/r/programming/comments/wld04/eli_benderskys_website_computed_goto_for/
>>
>>
>>
>> http://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables/
>>
>>
>
>
> The presented example is insanely unsafe. By giving invalid input, you
> can basically branch randomly.
>
> The check added by the switch is what is required to make it safe, so it
> isn't faster at the end.
>
> The case in the article isn't very strong.

You should always verify your bytecode before executing it anyway.

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org


More information about the Digitalmars-d mailing list