2.1.21. -Dname[(parm-list)][=def]

This option defines the macro name.





Is the name of the macro to be defined.


Is an optional list of comma-separated macro parameters. By appending a macro parameter list to the macro name, you can define function-style macros.

The parameter list must be enclosed in parentheses. When specifying multiple parameters, do not include spaces between commas and parameter names in the list.


Parentheses might need escaping on UNIX systems.


Is an optional macro definition.

If =def is omitted, the compiler defines name as the value 1.

To include characters recognized as tokens on the command line, enclose the macro definition in double quotes.


Specifying -Dname has the same effect as placing the text #define name at the head of each source file.


The compiler defines and undefines macros in the following order:

  1. compiler predefined macros

  2. macros defined explicitly, using -Dname

  3. macros explicitly undefined, using -Uname.


Specifying the option:

-DMAX(X,Y)="((X > Y) ? X : Y)"

on the command line is equivalent to defining the macro:

#define MAX(X, Y) ((X > Y) ? X : Y)

at the head of each source file.

See also

Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A