Set the Source Code Language Level
You can set the language level using compiler options or with
the #pragma langlvl directive. Note that a #pragma langlvl
directive in your source code overrides any conflicting compiler
options. When you set the language level, you also define the
macro associated with that level. The SAA C standards conform to
the ANSI standards, but also feature some additional elements.
You can set the language level of your source code to one of
the following levels:
- ANSI
- To set:
/Sa Compiler Option or #pragma
langlvl(ansi). Both of these define the macro
__ANSI__.
-
- Use this level when you want your code to be portable to
other compilers. To achieve this conformity, you must
also specify the /qnolonglong,
/Ss-, and Gf-options.
-
SAA Level 2
- To set:
/S2 Compiler Option
or #pragma
langlvl(saal2). Both define the macro __SAA_L2__.
-
- Note: You can also use #pragma langlvl(saa), which
defines the macro __SAA__. This level allows constructs
that conform to the most recent SAA C definition. Because
Level 2 is currently the most recent definition, the
__SAA__ and __SAA_L2__ macros are equivalent.
-
- Compile according to the SAA Level 2 standard. Use this
level when you want your code to be portable to other IBM
compilers.
-
- Extended
- To set:
/Se Compiler Option or #pragma
langlvl(extended). Both define the macro
__EXTENDED__.
-
- Allow extended language features, allow non-standard
language usage. Use this level when you are compiling
code ported from another compiler, or when you are
compiling code that does not need to be portable. If you
will be compiling and running your code primarily on the
workstation, you should use the extended language level.
-
Compatible
- To set:
/Sc Compiler Option or #pragma
langlvl(compat). Both define the macro __COMPAT__.
-
- Allow older versions of the C++ language. Use this level
when you are compiling older code.

Summary of Compiler Options
Description of the Language
Levels
Language-Dependent Compiler Options