Re: Goto considered dramafull
Kristof Bastiaensen <[email protected]>
| Newsgroups | gmane.comp.fonts.fontforge.devel |
|---|---|
| Message-ID | <[email protected]> |
I've found goto's useful for local error handling or cleanup. In that case it's just a lighweight way of doing exception handling. I find it much better than duplicating code, or faking it using a while statement. Edsger Dijkstra's wrote a famous article where he argued for removing the statement, but that was in a time when goto were overused, instead of more structured alternatives. If it is used with good judgement, I don't see the harm. On 30-08-14 08:06, Thomas Shinnick wrote: > I do not wish to start any drama nor religious wars. I'm just struck > by the number of places in python.c where the same cleanup-on-error > stanzas of free()s / DECREF's and other code occur a number of times > in one routine. It makes one nervous whether they all are *correctly* > duplicated. > > One accepted answer is just to repeat each group of lines ad nauseum, > as needed, even if needed 6 times in one routine. (!) > > Another answer is to consolidate into one stanza reached by multiple > goto's. All necessary free()s/DECREF's/etc. collected together. But > that's "goto", consider by some worse than GMO brocolli. > > As a data point, I find "goto" used a number of times in FF already: > mainline 155 > gdraw 11 > gutils 74 > as well as in of course GNUlib and other friends. > > Y'all have an absolute aversion to "goto" ? > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > > > _______________________________________________ > fontforge-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/fontforge-devel > http://fontforge.10959.n7.nabble.com/Developer-f3.html ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ fontforge-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fontforge-devel http://fontforge.10959.n7.nabble.com/Developer-f3.html