Sun Studio 12: C++ User's Guide

A.2.7 –compat[={4|5}]

Sets the major release compatibility mode of the compiler. This option controls the __SUNPRO_CC_COMPAT and __cplusplus macros.

The C++ compiler has two principal modes. The compatibility mode accepts ARM semantics and language defined by the 4.2 compiler. The standard mode accepts constructs according to the ANSI/ISO standard. These two modes are incompatible with each other because the ANSI/ISO standard forces significant, incompatible changes in name mangling, vtable layout, and other ABI details. These two modes are differentiated by the –compat option as shown in the following values.

A.2.7.1 Values

The -compat option can have the following values.

Value 

Meaning  

–compat=4

(Compatibility mode) Set language and binary compatibility to that of the 4.0.1, 4.1, and 4.2 compilers. Set the __cplusplus preprocessor macro to 1 and the __SUNPRO_CC_COMPAT preprocessor macro to 4.

–compat=5

(Standard mode) Set language and binary compatibility to ANSI/ISO standard mode. Set the __cplusplus preprocessor macro to 199711L and the __SUNPRO_CC_COMPAT preprocessor macro to 5.

Defaults

If the –compat option is not specified, –compat=5 is assumed.

If only –compat is specified, –compat=4 is assumed.

Interactions

You cannot use the standard libraries in compatibility mode (-compat[=4]).

Use of –compat[=4] with any of the following options is not supported.

Use of –compat=5 with any of the following options is not supported.

Warnings

When building a shared library do not use -Bsymbolic.

See also

C++ Migration Guide