aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cppawk-narg.118
1 files changed, 18 insertions, 0 deletions
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 <kaz@kylheku.com>