aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-04-13 21:16:48 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-04-13 21:16:48 -0700
commiteac4164e94b94e9f5f35e939e181352ddc634446 (patch)
tree464ddda43beed9d1dffa387b730a2fb5c133888c
parent6e4f7f90eb606c80014c06f19319e190ded43ec8 (diff)
downloadcppawk-eac4164e94b94e9f5f35e939e181352ddc634446.tar.gz
cppawk-eac4164e94b94e9f5f35e939e181352ddc634446.tar.bz2
cppawk-eac4164e94b94e9f5f35e939e181352ddc634446.zip
narg man page: mention narg() returning 1 in BUGS.
-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>