Go to main content
What's New in the Oracle® Developer Studio 12.5 Release

Exit Print View

Updated: July 2016
 
 

New Default for the C Compiler on Oracle Solaris

The following features are new defaults for the C compiler on Oracle Solaris:

  • The default mode for the C compiler has changed

  • The new default mode might affect your application

  • The old mode is available, if needed

__STDC_VERSION__ Changes

The following changes describe what is new with __STDC_VERSION__:

  • By default, previous versions of the C compiler on Oracle Solaris accepted all of the C99 and C11 features they knew about, but only claimed to conform to C89 by predefining __STDC_VERSION__ to 199409L.

  • By default, the new C compiler predefines __STDC_VERSION__ to 201112L, claiming C11 compliance.

Effect on User Applications on Oracle Solaris

The following information describes the effect on user applications on the Oracle Solaris platform:

  • Included files and feature tests that use macros such as _XOPEN_SOURCE, _POSIX_SOURCE, and _POSIX_C_SOURCE will likely resolve differently.

    For example, if you use _POSIX_SOURCE, this error is likely:

    Compiler or options invalid for pre-UNIX 03 X/Open applications

    The problem is that _POSIX_SOURCE technically requests a C89 compiler, as noted at the standards(5) man page.

    If your application tests for an older version of a standard (for example, _POSIX_SOURCE), consider code changes to try a newer version (in this example, _XOPEN_SOURCE=600)

  • User applications that test __STDC_VERSION__ will likely resolve differently

Temporary Workarounds for –xlang=c89

You probably do not want to explicitly select –std=c89, because doing so will disable C99 and C11 features.

Instead, if you select –xlang=c89, that will enable the new C compiler to accept the same programs and define the same __STDC_VERSION as previous versions of the C compiler.