DEFINE

Category

Language element control

Pragma equivalent

None.

Purpose

Defines a macro as in a #define preprocessor directive.

Syntax

Read syntax diagramSkip visual syntax diagramDEF(,name= def=)

Defaults

No default user definitions.

For the z/OS® UNIX System Services c99, c89, and c++ commands, the default for a regular compile is:
DEFINE(errno=(*__errno()))

DEFINE(_OPEN_DEFAULT=1)
For the z/OS UNIX System Services cc command, the default for a regular compile is:
DEFINE(errno=(*__errno()))

DEFINE(_OPEN_DEFAULT=0)

DEFINE(_NO_PROTO=1)

Parameters

DEFINE(name)
Is equal to the preprocessor directive #define name 1.
DEFINE(name=def)
Is equal to the preprocessor directive #define name def.
DEFINE(name=)
Is equal to the preprocessor directive #define name.

Usage

When the DEFINE option is in effect, the preprocessor macros that take effect before the compiler processes the file are defined.

You can use the DEFINE option more than once.

If the suboptions that you specify contain special characters, see Using special characters for information on how to escape special characters.

In the z/OS UNIX System Services environment, you can unset variables specified by -D, or automatically specified by c89, using -U when using the c89, cc, or c++ commands.

Note: c89 preprocesses -D and -U flags before passing them onto the compiler. xlc just passes -D and -U to the compiler, which interprets them as DEFINE and UNDEFINE. For more information, see c89 - Compiler invocation using host environment variables or xlc — Compiler invocation using a customizable configuration file.

Predefined macros

To use the __STRING_CODE_SET__ macro to change the code page that the compiler uses for character string literals, you must define it with the DEFINE compiler option; for example:
DEFINE(__STRING_CODE_SET__="ISO8859-1")

Examples

Note: There is no command-line equivalent for function-like macros that take parameters such as the following:
#define max(a,b)  ((a)>(b)?(a):(b))