GNU Info

Info Node: (m4.info)Macro Arguments

(m4.info)Macro Arguments


Next: Quoting Arguments Prev: Inhibiting Invocation Up: Macros
Enter node , (file) or (file)node

Macro arguments
===============

   When a name is seen, and it has a macro definition, it will be
expanded as a macro.

   If the name is followed by an opening parenthesis, the arguments
will be collected before the macro is called.  If too few arguments are
supplied, the missing arguments are taken to be the empty string.  If
there are too many arguments, the excess arguments are ignored.

   Normally `m4' will issue warnings if a builtin macro is called with
an inappropriate number of arguments, but it can be suppressed with the
`-Q' command line option.  For user defined macros, there is no check
of the number of arguments given.

   Macros are expanded normally during argument collection, and whatever
commas, quotes and parentheses that might show up in the resulting
expanded text will serve to define the arguments as well.  Thus, if FOO
expands to `, b, c', the macro call

     bar(a foo, d)

   is a macro call with four arguments, which are `a ', `b', `c' and
`d'.  To understand why the first argument contains whitespace,
remember that leading unquoted whitespace is never part of an argument,
but trailing whitespace always is.


automatically generated by info2www version 1.2.2.9