On Friday, July 27, 2012 16:05:07 Kagamin wrote: > On Friday, 27 July 2012 at 01:45:35 UTC, Jonathan M Davis wrote: > > It's a useful construct when used > > properly. It just shouldn't be used when there are better > > alternatives. > > Hmm... do you have a use case besides Duff's device and porting > legacy code?
There's quite a bit of code out there which uses it to jump to a common set of error handling code, which can actually make functions cleaner in some cases. Phobos even does this a few places (though not many). Also, as I understand it, there are cases in low level code (where you need every cycle that you can get) that using a goto to get out of a section of code can be more efficient than getting out of it in the ways that you would more typically do. I haven't personally run into that sort of thing though, since I don't generally write code that low level. And just because you or I don't use it much, doesn't mean that people programming in other domains don't need it for use cases that we never run into. goto is just one of those things that a systems language is bound to have. - Jonathan M Davis
