== Quote from Walter Bright (newshou...@digitalmars.com)'s article > 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>.
goto's jump to a label, so it's not like the compiler has no idea where entry points might be, anyway. And in the extreme case of languages with inline asm containing jump-to-address operations, I would think that the address would have to be computed at run-time, which is obviously after any optimization has been done. I suppose I'm failing to see the problem with goto's, assuming a structured language like D (as opposed to goto's in BASIC). > I keep thinking I should put on a "Compiler Construction" seminar! You should. The academic courses do a good job with theory and general application, but that isn't quite the same as one based on practical experience. Sean