There are 4,953 occurrences of "goto" in VTK 'master' today:<div>  4,828 in ThirdParty/</div><div>  125 in VTK itself</div><div><br></div><div>If nothing else, there's certainly a strong cultural bias against the use of goto in VTK code.<br>
<div><br></div><div>I don't like them, and I don't know anybody who really is a fan.</div><div><br></div><div>But if you think your code is more readable and maintainable with them, then goto it.</div><div><br></div>
<div>I am a very big fan of readability and maintainability. Although I really don't have a hard time reading either style... And just the presence of the "goto" makes my brain do a little double-take jump when I do see it.</div>
<div><br></div><div>There is precedence for allowing "goto" -- albeit sparingly.</div><div><br></div><div><br></div><div>David C.</div><div><br></div><div><br></div><div><div class="gmail_quote">On Tue, Jul 10, 2012 at 1:48 PM, David Lonie <span dir="ltr"><<a href="mailto:david.lonie@kitware.com" target="_blank">david.lonie@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Jul 10, 2012 at 1:32 PM, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:<br>

> Instead of the goto's, how about something like:<br>
><br>
>   bool err = this->CheckForError();<br>
><br>
> if (!err)<br>
> {<br>
>    mplMathTextLib = PyImport_ImportModule("matplotlib.mathtext");<br>
>    err = this->CheckForError(mplMathTextLib);<br>
> }<br>
><br>
</div>> [snip]<br>
<div class="im">><br>
> if (err)<br>
>      {<br>
>      // in case the error was an exception.<br>
>      delete this->Parser;<br>
>      this->Parser = NULL;<br>
>     }<br>
> }<br>
<br>
</div>That would work, but I think it loses quite a bit of readability,<br>
especially if applied to something like this (taken from a local patch<br>
I'm working on):<br>
<br>
<a href="http://codepad.org/E1DVBfhY" target="_blank">http://codepad.org/E1DVBfhY</a><br>
<br>
That snippet has a somewhat complicated loop and needs to clean up<br>
objects in a couple of places mid-loop and also before returning. It<br>
could be converted to something like above, but I still think gotos<br>
are the best solution here.<br>
<br>
Is there an argument against them, other than that they're unusual in<br>
c++? IMO I think they're fine in simple cases like these.<br>
<br>
Dave (the other-other dave)<br>
</blockquote></div><br></div></div>