### Description of the Language Levels

### ANSI

Setting the ANSI language level allows only language constructs that conform to ANSI C standards or, for C++ code, that conform to the standards in the ANSI working paper on C++ standards. All non-ANSI constructs cause compiler errors.

Use this language level to write code that is portable across ANSI-conforming systems. If your code is error-free at this level, it should be error-free with any other compiler.

Note: Because IBM C and C++ Compilers has a strict interpretation of the ANSI standard, it can find errors in code that compiles cleanly with other compilers. If you are porting code into IBM C and C++ Compilers, compile with the Extended language level.

### SAA Level 2 (C)

Setting SAA Level 2 allows only language constructs that conform to SAA Level 2 C standards. This language level is valid for C code only, because there is no SAA standard for C++. SAA constructs include all those allowed under the ANSI language level, because the SAA C standard conforms to the ANSI standard. All non-SAA constructs cause compiler errors. This language level supports some additional library functions, and specifies some behaviors that are left as implementation-defined by the ANSI standard.

Use this language level to write code that is portable across SAA systems. If your code is error-free at this level, it should be error-free with any other IBM compiler.

### Extended

Extended is the default language level.

The Extended language level allows all IBM C and C++ Compilers language constructs. These include all constructs that fall under the ANSI and SAA Level 2 language levels and the IBM C and C++ Compilers extensions to those standards.

This level also allows certain Windows library functions.

Use the extended language level when you are creating code that does not need to be portable, or when you are porting code into IBM C and C++ Compilers from another compiler or platform.

### Compatible (C++)

The Compatible language level allows constructs and expressions that were allowed by earlier levels of the C++ language. This language level is valid for C++ code only.

When the language level is set to compatible:

- Classes declared or defined within classes or declared within argument lists are given the scope of the closest non-class.
- typedefs and enumerated types declared within a class are given the scope of the closest non-class.
- The overload keyword is recognized and ignored.
- An expression showing the dimension in a delete expression is parsed and ignored. For example, given:

         delete [20] p;

  20 is ignored.

- Conversions from const void* and volatile void* to void* are allowed. At other language levels, these conversions would require an explicit cast.
- Where a conversion to a reference type uses a compiler temporary type, the reference need not be to a const type.
- You can bypass initializations as long as they are not constructor initializations.
- You can return a void expression from a function that returns void.
- operator++ and operator-- without the second zero argument are matched with both prefix and postfix ++ and --.
- You can use the $ character in identifiers. Note that you can also use $ in C++ files when the language level is set to extended.
- In a cast expression, the type to which you are casting can include a storage class specifier, function-type specifier (inline or virtual), template specifier, or typedef. At other language levels, the type must be a data type, class, or enumerated type.
- You can have a trailing comma in a list of enumerators, for example, enum E {e , };.
- Given the expression class A *a = new(x) A[100];, the compiler looks for a member operator new because the placement syntax (new(x)) is used. The member operators are not typically used to allocate arrays.
- You can use the comma operator in a constant expression. This allows comma expressions to be used in places like case labels and array bounds, where they are normally prohibited.
- You can declare a member function using both the inline and static keywords, for example, inline static void sandra :: pete(void);. The static keyword is ignored.
- No error is generated if a function declared to return a non-void type does not contain at least one return statement. Such a function can also contain return statements with no value without generating an error.
- If two pointers to functions differ only in their linkage types, they are considered to be compatible types.

Use this language level to write code that is portable to systems with older implementations of C++, or to port older code to the IBM C and C++ Compilers product.

Set the Source Code Language Level

Summary of Compiler Options
Summary of C Language Level Conflicts