-D

Pragma equivalent

None.

Purpose

Defines a macro as in a #define preprocessor directive.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -D--name--+---------------+--------------------------------><
              '-=--definition-'   

Defaults

Not applicable.

Parameters

name
The macro you want to define. -Dname is equivalent to #define name. For example, -DCOUNT is equivalent to #define COUNT.
definition
The value to be assigned to name. -Dname=definition is equivalent to #define name definition. For example, -DCOUNT=100 is equivalent to #define COUNT 100.

Usage

Using the #define directive to define a macro name already defined by the -D option will result in an error condition.

The -Uname option, which is used to undefine macros defined by the -D option, has a higher precedence than the -Dname option.

Predefined macros

The compiler configuration file uses the -D option to predefine several macro names for specific invocation commands. For details, see the configuration file for your system.

Examples

To specify that all instances of the name COUNT be replaced by 100 in myprogram.c, enter:
xlc myprogram.c -DCOUNT=100

Related information



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us