octave-maintainers
[Top][All Lists]
Advanced

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

Re : one return


From: Tatsuro MATSUOKA
Subject: Re : one return
Date: Thu, 28 Jul 2016 13:56:36 +0900 (JST)

> Hi all, 

> in the documentation Appendix D6, near the end, I read: 
> In functions, minimize the number of return statements, but elimination 

> of all but one return is not required. 

> 

> Well, that is a contradiction. 
> The minimal number of returns is 1 always. 
> Maybe one should write that the number of returns should be chosen so 
> that the code clearness is maximized. 
> 

> Very nice discussion: 
> 

> http://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement
> and links therein. 
> 

> I personally think, blind minimization of returns does not only not 
> optimize the code 
> but in contrary, often makes things worse. 
> 

> What do you think about that? 
> 

> Erns

Which manual do you see?

The manual on the octave official page

https://www.gnu.org/software/octave/doc/interpreter/C_002b_002b-Sources.html#C_002b_002b-Sources


There described.
In functions, minimize the number of return statements—use nested if statements 
if possible.

The above is the same as those embedded with 4.0.3

BTW,
you seem to make a post by rewriting other post.
However, this is not favorable because it will be included to the original 
thread.

See:
http://octave.1599824.n4.nabble.com/GSL-in-octave-tp4678376p4678853.html


Do not use other post to make a new post.
(I have done the same mistakes before.)

Tatsuro 



reply via email to

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