Impressed

Marco Leise Marco.Leise at gmx.de
Fri Jul 27 07:03:00 PDT 2012


Am Fri, 27 Jul 2012 07:22:49 +0000 (UTC)
schrieb Stefan Scholl <stesch at no-spoon.de>:

> Stuart <stugol at gmx.com> wrote:
> > Why does D have GOTO? I haven't used GOTO in over a decade, 
> > because it's truly evil.
> 
> Dogmas are evil.

+1
I clicked through a few responses, and this one I liked most.
It feels like GOTO was stigmatized during the days when if/for/while appeared to replace its omni presence. Back than it was ok to shout and scream about every use, but today it is more likely that people who use goto, know what they are doing.

I use it in switch-case for "preprocessing", where there may be 3 cases that all end at case 3:, but case 1 and 2 need something done first. Now you can just goto case 3 at the end of 1 & 2.
Also when I have a sequence of steps to be done and some steps may jump back a few steps, I prefer labels with good names + goto, over blocks of for/while/if, which distract from the sequential nature of the code.

It's funny how I felt a bit offended by "Why does D have GOTO? […] it's truly evil." :D

-- 
Marco



More information about the Digitalmars-d mailing list