7.31 -Dname[(parm-list)][=def]

Defines the macro name.

Syntax

-Dname[(parm-list)][=def]
Where:
name
Is the name of the macro to be defined.
parm-list
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.
=def
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.

Usage

Specifying a macro and a definition with -Dmacro=def has the same effect as placing the text #define macro def at the head of each source file.
Specifying a macro without a definition with -Dmacro has the same effect as placing the text #define macro 1 at the head of each source file.

Restrictions

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.

Example

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.
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.