.ARGCNT

Rewritten June 2020

.ARGCNT evaluates to the number of arguments passed to the current SBX, function or procedure, or -1 if not applicable. The value remains valid throughout the scope, i.e. despite prior calls to other SBXs, functions, or procedures from within the current scope.

History

2016 November, A-Shell 6.3.1534, compiler edit 790:  use of .ARGCNT within a PRIVATE_BEGIN / PRIVATE_END block now generates a compile error. Although the expression wouldn't technically be illegal, because the PRIVATE block is essentially called for initialization by whatever function or procedure in the module gets called first, there's really no good way to predict in advance what the .ARGCNT value will represent, and thus it is almost certain to create a discrepancy between the expected and actual behavior.

2012 November, A-Shell 6.0.1262:  The current .ARGCNT value (# of arguments passed to the current subroutine, function or procedure) is no longer wiped out by calls to functions or procedures. This eliminates the need to copy it to a local variable immediately upon entrance into a routine.