octave-3.0.3 accepts 'function' without 'endfucntion' (or with redundant 'endfunction')

David Grundberg individ at acc.umu.se
Sat Jul 11 05:10:57 CDT 2009


John W. Eaton skrev:
> On 10-Jul-2009, Sergei Steshenko wrote:
>
> | I think that missing 'end'/'endfunction' should always cause warnings.
>
> Matlab users wouldn't like that very much since a .m file with
>
>   function [retvals] = foo (args)
>   % function body here
>
> is valid and doesn't result in any warnings in Matlab.
>
> jwe
>   
Yes, this is true. Matlab doesn't give any warning. I got a little bit 
confused. It is the static analyzer in the Matlab editor that nags about 
functions missing 'end's! I think this is a good idea since Mathworks 
probably just want to support old code while still making sure that new 
code are up to a better standard.

Maybe Octave could have a "lint" command that can find problematic 
constructs like this?

David


More information about the Bug-octave mailing list