Compiler option defaults

You can use various options to change the compilation of your program. You can specify compiler options when you invoke the compiler or, in a C program, in a #pragma options directive in your source program. Options, that you specify when you invoke the compiler, override installation defaults and compiler options that are specified through a #pragma options directive.

The compiler option defaults that are supplied by IBM can be changed to other selected defaults when z/OS® XL C/C++ is installed. For further information, see Customizing default options for z/OS XL C/C++ compiler.

To find out the current defaults, compile a program with only the SOURCE compiler option specified. The compiler listing shows the options that are in effect at invocation. The listing does not reflect options that are specified through a #pragma options directive in the source file.

The c89 and xlc utilities that run in the z/OS UNIX shell specify certain compiler options in order to support POSIX standards. For a complete description of these utilities, refer to c89 — Compiler invocation using host environment variables, xlc — Compiler invocation using a customizable configuration file, or to the z/OS UNIX System Services Command Reference. For some options, these utilities specify values that are different than the supplied defaults in MVS™ batch or TSO environments. However, for many options, they specify the same values as in MVS batch or TSO. There are also some options that these utilities do not specify explicitly. In those cases, the default value is the same as in batch or TSO. An option that you specify explicitly using these z/OS UNIX utilities overrides the setting of the same option if it is specified using a #pragma options directive. The exception is CSECT, where the #pragma csect directive takes precedence.

In effect, invoking the compiler with the c89 and xlc utilities overrides the default values for many options, compared to running the compiler in MVS batch or TSO. For example, the c89 utility specifies the RENT option, while the compiler default in MVS batch or TSO is NORENT. Any overrides of the defaults by the c89 and xlc utilities are noted in the DEFAULT category for the option. As the compiler defaults can always be changed during installation, you should always consult the compiler listing to verify the values passed to the compiler. See Using the z/OS XL C compiler listing and Using the z/OS XL C++ compiler listing for more information.

The c89 utility remaps the following options to the values shown. Note that these values are set for a regular (non-IPA) compile. These values will change if you invoke IPA Compile, IPA Link, or specify certain other options. For example, specifying the c89 -V option changes the settings of many of the compiler listing options. See c89 — Compiler invocation using host environment variables or xlc — Compiler invocation using a customizable configuration file for more information and also refer to the default information provided for each compiler option.

The c89 options remapped are as follows:

     LOCALE(POSIX)
     LANGLVL(ANSI)
     OE
     LONGNAME
     RENT
     OBJECT(file_name.o)
     NOLIST(/dev/fd1)
     NOSOURCE(/dev/fd1)
     NOPPONLY(NOCOMMENTS,NOLINES,/dev/fd1,2048)
     DEFINE(errno=\\(*__errno\\(\\)\\))
     DEFINE(_OPEN_DEFAULT=1)

The c89 command name supported by the xlc utility has the same defaults as the c89 command name supported by the c89 utility.

The cc options remapped are as follows:
     NOANSIALIAS
     LOCALE(POSIX)
     LANGLVL(COMMONC)
     OE
     LONGNAME
     RENT
     OBJECT(file_name.o)
     NOLIST(/dev/fd1)
     NOSOURCE(/dev/fd1)
     NOPPONLY(NOCOMMENTS,NOLINES,/dev/fd1,2048)
     DEFINE(errno=\\(*__errno\\(\\)\\))
     DEFINE(_OPEN_DEFAULT=0)
     DEFINE(_NO_PROTO=1)

The cc command name supported by the xlc utility has the same defaults as the cc command name supported by the c89 utility.

The c++ options remapped are as follows:

     LOCALE(POSIX)
     OE
     OBJECT(file_name.o)
     NOINLRPT(/dev/fd1)
     NOLIST(/dev/fd1)
     NOSOURCE(/dev/fd1)
     NOPPONLY(NOCOMMENTS,NOLINES,/dev/fd1,2048)
     DEFINE(errno=\\(*__errno\\(\\)\\))
     DEFINE(_OPEN_DEFAULT=1)

All C++ command names (xlc, cxx, c++, xlc++) supported by the xlc utility have the same defaults as the c++ and cxx commands supported by the c89 utility.

The xlc and c99 command names supported by the xlc utility have the same defaults as the c89 command name supported by the c89 utility, except for the following:
Note that the locale option is set according to the environment where the cc, c89, and c++ commands are invoked. The current execution locale is determined by the values associated with environment variables LANG and LC_ALL. The following list shows the order of precedence for determining the current execution locale:
Note that for SEARCH, the value is determined by the following: Refer to SEARCH | NOSEARCH for more information on SEARCH.

For the remainder of the compiler options, the c89 utility default matches the C/C++ default. Some of these are explicitly specified by c89, cc, or c++. Therefore if the installation changes the default options, you may find that c89, cc, or c++ continues to use the default options. You can use the _C89_OPTIONS, _CC_OPTIONS, or _CXX_OPTIONS environment variable to override these settings if necessary. Note that certain options are required for the correct execution of c89, cc, or c++.