Oracle® Solaris Studio 12.4: C User's Guide

Exit Print View

Updated: March 2015

Features of C11

This appendix discusses the features of the ISO/IEC 9899:2011, Programming Language - C standard currently supported by the C compiler.

The -std=c11 flag controls compiler recognition of 9899:2011 ISO/C. For more information about the syntax of the -std flag, see –std=value.

C.1 Keywords

  • _Alignas

  • _Alignof

  • _Noreturn

  • _Static_assert

  • _Thread_local

C.2 C11 Supported Features

  • _Alignas specifier

  • _Alignof operator

  • _Noreturn

  • _Static_assert

  • _Thread_local storage specifier

  • Allow typedef redefinition

  • anonymous structs/unions

  • Updated set of UCN characters allowed

  • __STDC_ANALYZABLE__ macro

  • __STDC_NO_ATOMICS__ macro

  • __STDC_NO_THREADS__ macro

C.2.1 _Alignas specifier

Feature: 6.7.5 Alignment specifier

_Alignas ( type-name )
_Alignas ( constant-expression )

The _Alignas specifier cannot be used in a declaration of a typedef, a bit-field, a function, a parameter, or an object declared with the register storage-class specifier.

The constant expression shall evaluate to an integer constant expression The constant expression must evaluate to an integer constant expression that is a power of 2 between 1 and 128. Valid values are: 0, 1,2, 4, 8, 16, 32, 64, and 128. The value must evaluate to an alignment that is the same or stricter than the alignment that would be required for the type of the object or member being declared.

_Alignas ( type-name) is equivalent of _Alignas (_Alignof (type-name)).

An alignment specifier of 0 has no effect.

The effective alignment is that of the strictest alignment specifier.

An object declared with an alignment specifier must be specified with the same alignment specifier, or no alignment specifier, on every other declaration of that object. The alignment of an object must be specified the same in every source file declaring the same object, or behavior is undefined.

C.2.2 _Alignof operator

Feature: _Alignof operators

_Alignof ( type-name )

The _Alignof operator evaluates to an integer constant representing the alignment requirement of its operand type. The operand is not evaluated. The _Alignof operator cannot be used on a function or incomplete type.

C.2.3 _Noreturn

Feature: 6.7.4 Function Specifiers, _Noreturn

Place the _Noreturn specifier in the declaration of a function that never returns, for example:

_Noreturn void leave () {

C.2.4 _Static_assert

Feature: 6.7.10 Static assertions

_Static_assert ( constant-expression , string-literal ) ;

C.2.5 Universal Character Names (UCN)

Update the set of characters allowed in UCNs as per Annex D of ISO/IEC 9899:2011. Refer to ISO/IEC 9899:2011 Annex D for the full list of characters allowed.