Computed gotos on Reddit
deadalnix
deadalnix at gmail.com
Sun Jul 22 20:05:02 PDT 2012
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.
More information about the Digitalmars-d
mailing list