Macro definitions are not stored in the object file. They are
only active for the duration of a single source file starting when
they are defined and ending when they are undefined (using
#undef), redefined, or when the end of the source file is
found.
Macro definitions you wish to use in multiple source files may
be defined in an include file which may be included in each source
file where the macros are required.
When a macro with arguments is invoked, the macro processor
substitutes the arguments into the macro body and then processes
the results again for additional macro calls. This makes it
possible, but confusing, to piece together a macro call from the
macro body and from the macro arguments.
Most experienced C programmers enclose macro arguments in
parentheses when they are used in the macro body. This technique
prevents undesired grouping of compound expressions used as
arguments and helps avoid operator precedence rules overriding the
intended meaning of a macro.
While a macro may contain references to other macros,
references to itself are not expanded. Self-referencing macros are
a special feature of ANSI Standard C in that the self-reference is
not interpreted as a macro call. This special rule also applies to
indirectly self-referencing macros (or macros that reference
themselves through another macro).
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.