Compiler Modes

There are several forms of IBM C and C++ Compilers invocation commands that support various version levels of the C and C++ languages. Normally, you should use the xlc command for compiling your source files. You can, however, use other forms of the command if your particular environment and file systems require it. The various compiler invocations commands are:

Invocation Commands for IBM C and C++ Compilers
xlC xlC128 xlC_r xlC_r4 xlC_r7

xlc xlc128 xlc_r xlc_r4 xlc_r7

cc cc128 cc_r cc_r4 cc_r7

CC_4

c89

The four basic compiler invocation commands appear as the first entry of each line in the table above. Select a basic invocation using the following criteria:

xlC
Invokes the compiler so that source files are compiled as C++ language source code.

Files with .c suffixes, assuming you have not used the -+ compiler option, are compiled as C language source code with a default language level of ansi, and compiler option -qansialias specified to allow type-based aliasing.

Use this invocation for new C and C++ programs.

xlc
Invokes the compiler for C or C++ source files with a default language level of ansi, and specifies compiler option -qansialias to allow type-based aliasing. Use this invocation for new C programs.
cc 
Invokes the compiler for C or C++ source files with a default language level of extended and compler options -qnoro and -qnoroconst (to provide compatibility with the RT compiler and placement of string literals or constant values in read/write storage). Use this invocation for legacy C code that does not require compliance with ANSI C.
c89
Invokes the compiler for C or C++ source files, with a default language level of ansi, and specifies compiler options -qansialias (to allow type based aliasing) and -qnolonglong (disabling use of long long), and sets -D_ANSI_C_SOURCE (for ANSI-conformant headers). Use this invocation for strict conformance to the ANSI standard.

IBM C and C++ Compilers provides variations on the four basic compiler invocations. These variations are described below:

128-suffixed Invocations All 128-suffixed invocation commands are functionally similar to their corresponding base compiler invocations. They specify the -qldbl128 option, which increases the length of long double types in your program from 64 to 128 bits.
_r-suffixed Invocations All _r-suffixed invocations additionally sets the macro name -D_THREAD_SAFE, and add the libraries -L/usr/lib/threads, -Lusr/lib/dce, -lc_r and -lpthreads.

Use the -r-suffixed invocations if you want to create either Posix or AIX DCE threaded applications.

_r4-suffixed invocations provide compatibility between DCE
applications written for AIX Version 3.2.5 and AIX Version 4. They
link your application to the correct AIX Version 4 DCE libraries,
providing compatibility between the latest version of the pthreads
library and the earlier versions supported on AIX Version 3.2.5.

On AIX 4.3, use _r7-suffixed invocations to compile and link
applications conforming to DRAFT 7 of the Posix threads standard.
Otherwise, the compiler will by default compile and link applications
conforming to the current Posix threads standards.



C Language Levels


Invoking the Compiler