octave-maintainers
[Top][All Lists]
Advanced

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

Deprecate nargchk, nargoutchk?


From: Rik
Subject: Deprecate nargchk, nargoutchk?
Date: Thu, 21 Apr 2011 19:00:23 -0700

4/21/11

John,

Can we deprecate nargchk and nargoutchk?  These functions check the number
of arguments nargin and nargout and print a string if conditions aren't
met.  However, these functions never got any adoption in the core.  Instead
the following idiom developed.

if (nargin < argmin || nargin > argmax)
  print_usage ();
endif

This has two advantages.  First, it lists all ways to call the function
derived from the function help string rather than just a one-time string
argument such as "Invalid call to fcn".  Second, given that function
calls have an execution cost, it is more efficient to keep everything
within one function.

Cheers,
Rik


reply via email to

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