octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

goto vs. return?


From: Rik
Subject: goto vs. return?
Date: Sat, 23 Jan 2016 14:27:10 -0800

According to the Appendix in the manual on Contributing to Octave,

"Avoid comma expressions, labels and gotos, and explicit typecasts. If you need
to typecast, use the modern C++ casting operators. In functions, minimize the
number of return statements—use nested if statements if possible."

Which do we dislike more: goto statements or return from the middle of a
function?

I ask because I count 134 uses of goto in liboctave.  I think most of these
can be avoided now that the error_handler routine no longer returns.  The
others could probably be removed if we used return rather than goto in the
middle of a function.

I personally dislike goto more than return and would remove it, but maybe
there is a consensus in the other direction.

--Rik




reply via email to

[Prev in Thread] Current Thread [Next in Thread]