From eac4164e94b94e9f5f35e939e181352ddc634446 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 13 Apr 2022 21:16:48 -0700 Subject: narg man page: mention narg() returning 1 in BUGS. --- cppawk-narg.1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cppawk-narg.1 b/cppawk-narg.1 index c0d6c4f..c9f30a0 100644 --- a/cppawk-narg.1 +++ b/cppawk-narg.1 @@ -453,6 +453,24 @@ to produce an identical macro called This then allows for two "recursion" levels, whereby each one uses the macro under a different name. +Both +.B "narg()" +and +.B "narg(x)" +expand to 1. This is a "feature" of the preprocessor: the empty +argument list is indistinguishable from an empty argument, because +preprocessor arguments are not required to be non-empty sequences +of tokens. For instance if +.B mac +is a macro which may be called with two arguments, then +.B "mac(,)" +is a valid call, which passes two empty arguments. Consequently, +if the comma is deleted from the syntax, then there is one empty argument. +The number of arguments is the number of commas plus one. This is why +.B narg +is specified as taking one or more arguments: it is not possible for +any macro to be given fewer arguments than one. + .SH AUTHOR Kaz Kylheku -- cgit v1.2.3