foreach ... else statement

Walter Bright newshound1 at digitalmars.com
Tue Jan 6 21:07:34 PST 2009


Don wrote:
> I still avoid goto because I was told to. But eventually I realised that 
> it's 100% propaganda. I actually think my code would be cleaner if I 
> used it; it would allow lots of local flag variables to be eliminated.
> But I still have this residual prejudice against 'goto' which is really 
> hard to get rid of.

The problem with goto is it is easy to get into a human readability 
problem with it. No such problem exists for optimization algorithms.


> Yes, but I doubt any compiler would have a problem with goto.

The last time I even heard of a compiler that fell over and gave up 
optimizing if it saw a goto was in the early 80's. I have a hard time 
believing LDC has problems with it, but if it does, the authors should 
hit the books <g>.

I keep thinking I should put on a "Compiler Construction" seminar!

P.S. There are problems with goto'ing out of a finally block, and 
there's a problem in the optimizer with goto'ing from one try block to 
another, but that's not the issue here.



More information about the Digitalmars-d mailing list