bearophile wrote:
Don:
Actually Walter loves goto, so DMD copes really well with it.

When possible it's better to use structured programming and avoid gotos.

Structured programming does not mean no gotos. You should really read the original paper "Goto considered harmful", you'll find it's actually about the evil of spaghetti code, such as in BASIC. In C family-languages, including D, there is no spaghetti goto. So actually it's nearly impossible to abuse goto in D in the way that the original paper was talking about.

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.

That construct can avoid gotos in some common situations.

And regarding the compiler back-end, I think it's also better to start thinking 
what's good for LDC :-)
Yes, but I doubt any compiler would have a problem with goto.


Bye,
bearophile

Reply via email to