From 50ca46f1abdd6b8f5a80e1931d92967a4a6de0a1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 19 Apr 2022 06:55:31 -0700 Subject: man page: mention non-recursion of macros in BUGS. --- cppawk.1 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'cppawk.1') diff --git a/cppawk.1 b/cppawk.1 index bbf7b0c..5004943 100644 --- a/cppawk.1 +++ b/cppawk.1 @@ -303,6 +303,28 @@ and .B --prepro command line options. +The C preprocessor doesn't permit macro recursion, which introduces +limitations to the ability to compose invocations of +.B cppawk +macros, thus curtailing their power. +If in the expansion of +some macro +.B M +a call of macro +.B M +appears, that call is not expanded. This is relied upon by C programs which +use macros to inline same-named functions, for instance, if it were +acceptable for the argument of +.B strlen +to be evaluated twice, then this macro version would be permissible: +.ft B + #define strlen(x) (*(x) == 0 ? 0 : strlen(x)) +.ft R +Here, the +.B strlen +call in the macro expansion is relied upon not to be expanded as a macro, +in which case runaway expansion would occur. + .SH AUTHOR Kaz Kylheku -- cgit v1.2.3