-std (-qlanglvl)
Category
Purpose
Determines whether source code and compiler options should be checked for conformance to a specific language standard, or subset or superset of a standard.
Syntax
-qlanglvl syntax (C only) .-extc99---. >>- -q--langlvl--=--+-stdc89---+------------------------------->< +-extc89---+ +-stdc99---+ +-extended-+ +-stdc11---+ '-extc1x---'
-std syntax (C only) .-gnu9x----------. +-gnu99----------+ >>- -std--=--+-c89------------+-------------------------------->< +-c90------------+ +-c99------------+ +-c9x------------+ +-c11------------+ +-c1x------------+ +-iso9899:1990---+ +-iso9899:199409-+ +-iso9899:1999---+ +-iso9899:199x---+ +-iso9899:2011---+ +-gnu89----------+ +-gnu90----------+ '-gnu11----------'
-qlanglvl syntax (C++ only) .-extended---. >>- -q--langlvl--=--+-extended0x-+----------------------------->< '-extended1y-'
-std syntax (C++ only) .-gnu++98-. +-gnu++03-+ >>- -std--=--+-c++98---+--------------------------------------->< +-c++03---+ +-c++11---+ +-gnu++11-+ +-c++0x---+ +-gnu++0x-+ '-c++1y---'
Defaults
- -std=gnu99 or -std=gnu9x
- -std=gnu++98
- The default is set according to the command used
to invoke the compiler:
- -qlanglvl=extc99 for the xlc and related invocation commands
- -qlanglvl=extended for the cc and related invocation commands
- -qlanglvl=stdc89 for the c89 and related invocation commands
- -qlanglvl=stdc99 for the c99 and related invocation commands
- The default is set according to the command used to invoke the compiler:
- -qlanglvl=extended for the xlC or xlc++ and related invocation commands
Parameters for C language programs
Parameters
of the -std option:
Parameters
of the -qlanglvl option:- c89 | c90 | iso9899:1990
- Compilation conforms strictly to the ANSI C89 standard, also known as ISO C90.
- iso9899:199409
- Compilation conforms strictly to the ISO C95 standard.
- c99 | c9x | iso9899:1999 | iso9899:199x
- Compilation conforms strictly to the ISO C99 standard, also known as ISO C99.
- c11 | c1x | iso9899:2011
- Compilation conforms strictly to the ISO C11 standard.
- gnu89 | gnu90
- Compilation conforms to the ANSI C89 standard and accepts implementation-specific language extensions, also known as GNU C90.
- gnu99 | gnu9x
- Compilation conforms to the ISO C99 standard and accepts implementation-specific language extensions, also known as GNU C99.
- gnu11
- Compilation conforms to the ISO C11 standard and accepts implementation-specific language extensions, also known as GNU C11.
- stdc89
- Compilation conforms strictly to the ANSI C89 standard, also known as ISO C90.
- extc89
- Compilation conforms to the ANSI C89 standard and accepts implementation-specific language extensions.
- stdc99
- Compilation conforms strictly to the ISO C99 standard.
- extc99
- Compilation conforms to the ISO C99 standard and accepts implementation-specific language extensions.
- extended
- Compilation is based on the ISO C89 standard, with some differences to accommodate extended language features.
- stdc11
- Compilation conforms strictly to the ISO C11 standard.
- extc1x
- Compilation is based on the C11 standard, invoking all the currently supported C11 features and other implementation-specific language extensions.
The following tables reflect the mapping
between the -qlanglvl and -std suboptions:
-qlanglvl suboption | Mapping to -std suboption |
---|---|
stdc89 | c89 | c90 | iso9899:1990 |
extc89 | gnu89 | gnu90 |
stdc99 | c99 | c9x | iso9899:1999 | iso9899:199x |
extc99 | gnu99 | gnu9x |
stdc11 | c11 | c1x | iso9899:2011 |
extc1x | gnu11 |
Parameters for C++ language programs
Parameters of the -std option:
- gnu++98 | gnu++03
- Compilation is based on the ISO C++98 standard, with some differences to accommodate extended language features.
- c++98 | c++03
- Compilation conforms strictly to the ISO C++ standard, also known as ISO C++98.
- c++11 | c++0x
- Compilation conforms strictly to the ISO C++ standard plus amendments, also known as ISO C++11.
- gnu++11 | gnu++0x
- Compilation is based on the ISO C++ standard, with some differences to accommodate extended language features.
- c++1y
- Compilation is based on the C++14 standard, invoking most of the C++11 features and all the currently supported C++14 features.
Parameters of the -qlanglvl option:
- extended
- Compilation is based on the ISO C++ standard, with some differences to accommodate extended language features.
- extended0x
- Compilation is based on the C++11 standard, invoking most of the C++ features and all the currently-supported C++11 features.
- extended1y
- Compilation is based on the C++14 standard, invoking most of the
C++11 features and all the currently supported C++14 features.Note: IBM supports selected features of C++14 standard. IBM will continue to develop and implement the features of this standard. The implementation of the language level is based on IBM's interpretation of the standard. Until IBM's implementation of all the C++14 features is complete, including the support of a new C++14 standard library, the implementation might change from release to release. IBM makes no attempt to maintain compatibility, in source, binary, or listings and other compiler interfaces, with earlier releases of IBM's implementation of the new C++14 features.
The following tables reflect the mapping
between the -qlanglvl and -std suboptions:
-qlanglvl suboption | Mapping to -std suboption |
---|---|
extended | gnu++98 | gnu++03 |
extended0x | gnu++11 | gnu++0x |
extended1y | c++1y |
Predefined macros
See Macros related to language levels for a list of macros that are predefined by -qlanglvl suboptions.