Mercurial > octave
diff examples/code/oct_demo.cc @ 21059:73ab962bc52d
doc: Use newer coding conventions in examples/code directory.
* FIRfilter.m, FIRfilter_aggregation.m, display.m, subsasgn.m, subsref.m,
display.m, end.m, get.m, numel.m, plot.m, polynomial.m,
polynomial_superiorto.m, polyval.m, roots.m, set.m, subsasgn.m, subsref.m,
celldemo.cc, fortrandemo.cc, funcdemo.cc, globaldemo.cc, oct_demo.cc,
paramdemo.cc, stringdemo.cc:
Use newer coding conventions in examples/code directory.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 13 Jan 2016 16:21:24 -0800 |
parents | c8240a60dd01 |
children | a66a737913b5 |
line wrap: on
line diff
--- a/examples/code/oct_demo.cc Wed Jan 13 17:28:42 2016 +1100 +++ b/examples/code/oct_demo.cc Wed Jan 13 16:21:24 2016 -0800 @@ -46,17 +46,20 @@ // 3) The number of output arguments // 4) A string to use as help text if 'help <function_name>' is entered. // -// Note below that the third parameter (nargout) of DEFUN_DLD is not used, -// so it is omitted from the list of arguments in order to avoid a warning -// from gcc about an unused function parameter. +// Note below that the third parameter (nargout) of DEFUN_DLD is not used. -DEFUN_DLD (oct_demo, args, , +DEFUN_DLD (oct_demo, args, /* nargout */, "[...] = oct_demo (...)\n\ \n\ -Print a greeting followed by the values of all the arguments passed.\n\ +Print a greeting followed by the values of all input arguments.\n\ +\n\ Return all arguments in reverse order.") { - // The list of values to return. See the declaration in oct-obj.h + // The inputs to this are available in the variable named args. + + int nargin = args.length (); + + // The list of values to return. See the declaration in ovl.h. octave_value_list retval; @@ -64,10 +67,6 @@ octave_stdout << "Hello, world!\n"; - // The inputs to this function are available in args. - - int nargin = args.length (); - // The octave_value_list class is a zero-based array of octave_value objects. // The declaration for the octave_value class is in the file ov.h. // The print() method will send its output to octave_stdout,