With the introduction of support for C11, the language dialect is no longer a simple binary choice between C89 & C99, there is now a third choice: C11.
With Oracle Solaris Studio 12.3 the choice was C99 vs C89 and was controlled by the –xc99 flag:
|
With Oracle Solaris Studio 12.4 and Oracle Developer Studio 12.5 the choice of language dialect (C89, C99, or C11) should be controlled using the –std flag:
|
The following is a simple mapping between –xc99 flag and the –std flag:
|
The following options for controlling language dialec are or will soon be deprecated in the Oracle Developer Studio C Compiler: –Xc, –Xa, –Xt, –xc99.
–xc99: Choose between ISO C99 or C89 language
–Xc: Issue errors and warnings for programs that use non-ISO C constructs
–Xa: Accept ISO C plus extensions to the C language
–Xt: Accept ISO C plus K&R C compatibility extensions
–Xs: Accept K&R C
Instead, the –std option should be used, along with the –pedantic option if you were using –Xa. Legacy code using –Xt or –Xs will need conversion to an ISO C dialect.
The –xlang option can be used to control the behavior of specific libc functions that relate to standard conformance. In the Oracle Solaris Studio 12.4 C compiler, the default behavior was C11 language constructs and C89 library behavior. In this default mode, ___STDC_VERSION__ (199409L) indicates the C89 standard.
In the Oracle Developer Studio 12.5 C Compiler, both the language features and library behavior defaults to C11 mode, and __STDC_VERSION__ (201112L) reflects C11.
Note: In Oracle Solaris Studio 12.3, this behavior was controlled by the suboption –xc99=lib.