On Wed, 26 Sep 2012 21:29:39 +0200 Tom Hacohen <t...@stosb.com> said:
> On 26/09/12 21:19, Eduardo Lima (Etrunko) wrote: > > On Wed, Sep 26, 2012 at 4:01 PM, Enlightenment SVN > > <no-re...@enlightenment.org> wrote: > >> Log: > >> Ecore_Evas (wayland): Remove goto. (don't need them, don't want them) > > > > Why? There is goto all over the code. > > Yeah. Furthermore, in my point of view, the code you removed is by an > order of magnitude better than the new code. A common cleanup location > for functions is a good thing... that is indeed a good point. the "goto's are evil so never use them" brigade has ultimately had a negative effect. - devilhorns - now on you. :) goto's have their place. don't use liberally - buty use them WHEN they simplify flow. examples. exception handling (if (!something) goto err;) and in err: u hav e common shared cleanup code that cleans up any stuff u have begin to build/alloc etc. - it saves repeating this again and again. it also saves nesting like a madman: if (a) { if (b) { if (c) { return x; } else { cleanup type 3 } } else { cleanup type 2 } } else { cleanup type 1 } return 0; vs. if (!a) goto err; if (!b) goto err; if (!c) goto err; return x; err: cleanup all return 0; which one of these is easier to read and maintain? hell which is easier to WRITE? the point of "goto is evil" is when you use gotos INSTEAD of while/for/if etc. flow control and then the code becomes HARD to follow with lots of gotos jumping about. you no longer easily see the flow of the code. when a goto is used to break out of several nestings of for/while etc. sections without having it bit by bit break out of each one separately, or i'ts used to group some common cleanup code to simplify something, then they are good. simply - do they improve code readability and maintainability,. if they do - then use them. :) -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- The Rasterman (Carsten Haitzler) ras...@rasterman.com ------------------------------------------------------------------------------ How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel