#pragma langlvl

Description

The #pragma langlvl directive selects the C language level for compilation.

Syntax

Read syntax diagramSkip visual syntax diagram>>-#--pragma--langlvl--(----language----)----------------------><
 

where values for language are described below.

C only For C programs, you can specify one of the following values for language:

classic Allows the compilation of non-stdc89 programs, and conforms closely to the K&R level preprocessor.
extended Provides compatibility with the RT compiler and classic. This language level is based on C89.
saa Compilation conforms to the current SAA C CPI language definition. This is currently SAA C Level 2.
saal2 Compilation conforms to the SAA C Level 2 CPI language definition, with some exceptions.
stdc89 Compilation conforms to the ANSI C89 standard, also known as ISO C90.
stdc99 Compilation conforms to the ISO C99 standard.
extc89 Compilation conforms to the ANSI C89 standard, and accepts implementation-specific language extensions.
extc99 Compilation conforms to the ISO C99 standard, and accepts implementation-specific language extensions.

extended Compilation is based on strict98, with some differences to accommodate extended language features.
strict98 Compilation conforms to the ISO C++ standard for C++ programs.

Default

The default language level varies according to the command you use to invoke the compiler:

Invocation
Default language level
xlc
extc89
cc
extended
c89
stdc89
c99
stdc99

Notes

This pragma can be specified only once in a source file, and it must appear before any noncommentary statements in a source file.

The compiler uses predefined macros in the header files to make declarations and definitions available that define the specified language level.

This directive can dynamically alter preprocessor behavior. As a result, compiling with the -E compiler option may produce results different from those produced when not compiling with the -E option.

Related information