Contents

About this document

  • Who should read this document
  • Supported language standards
  • Other standards and specifications
  • Language levels and language extensions
  • Extensions to C++ to support C99 standard features
  • Extensions related to GNU C and C++
  • Extensions supporting the AltiVec Programming Interface
  • How to use this document
  • How this document is organized
  • Conventions used in this document
  • Typographical conventions
  • Qualifying elements (icons and bracket separators)
  • How to read syntax diagrams
  • Examples
  • Related publications
  • Scope and linkage

  • Scope
  • Block/local scope
  • Function scope
  • Function prototype scope
  • File/global scope
  • Examples of scope in C
  • Class scope (C++ only)
  • Namespaces of identifiers
  • Name hiding (C++ only)
  • Program linkage
  • Internal linkage
  • External linkage
  • No linkage
  • Language linkage (C++ only)
  • Lexical Elements

  • Tokens
  • Keywords
  • Identifiers
  • Literals
  • Punctuators and operators
  • Source program character set
  • Multibyte characters
  • Escape sequences
  • The Unicode standard
  • Digraph characters
  • Trigraph sequences
  • Comments
  • Data objects and declarations

  • Overview of data objects and declarations
  • Overview of data objects
  • Overview of data declarations and definitions
  • Storage class specifiers
  • The auto storage class specifier
  • The static storage class specifier
  • The extern storage class specifier
  • The mutable storage class specifier (C++ only)
  • The register storage class specifier
  • Type specifiers
  • Integral types
  • Boolean types
  • Floating-point types
  • Character types
  • The void type
  • Compatibility of arithmetic types (C only)
  • Vector types
  • User-defined types
  • Structures and unions
  • Enumerations
  • Compatibility of structures, unions, and enumerations (C only)
  • typedef definitions
  • Type qualifiers
  • The const type qualifier
  • The volatile type qualifier
  • The restrict type qualifier
  • The __align qualifier
  • Type attributes
  • The aligned type attribute
  • The packed type attribute
  • The transparent_union type attribute (C only)
  • Declarators

  • Overview of declarators
  • Examples of declarators
  • Type names
  • Pointers
  • Pointer arithmetic
  • Type-based aliasing
  • Compatibility of pointers (C only)
  • Arrays
  • Variable length arrays
  • Compatibility of arrays
  • References (C++ only)
  • Initializers
  • Initialization and storage classes
  • Designated initializers for aggregate types (C only)
  • Initialization of vectors
  • Initialization of structures and unions
  • Initialization of enumerations
  • Initialization of pointers
  • Initialization of arrays
  • Initialization of references (C++ only)
  • Variable attributes
  • The aligned variable attribute
  • The packed variable attribute
  • The init_priority variable attribute (C++ only)
  • The mode variable attribute
  • The section variable attribute
  • The weak variable attribute
  • Type conversions

  • Arithmetic conversions and promotions
  • Integral conversions
  • Boolean conversions
  • Floating-point conversions
  • Integral and floating-point promotions
  • Lvalue-to-rvalue conversions
  • Pointer conversions
  • Conversion to void*
  • Reference conversions (C++ only)
  • Qualification conversions (C++ only)
  • Function argument conversions
  • Expressions and operators

  • Lvalues and rvalues
  • Primary expressions
  • Names
  • Literals
  • Integer constant expressions
  • Identifier expressions (C++ only)
  • Parenthesized expressions ( )
  • Scope resolution operator :: (C++ only)
  • Postfix expressions
  • Function call operator ( )
  • Array subscripting operator [ ]
  • Dot operator .
  • Arrow operator ->
  • Compound literals
  • The typeid operator (C++ only)
  • The static_cast operator (C++ only)
  • The reinterpret_cast operator (C++ only)
  • The const_cast operator (C++ only)
  • The dynamic_cast operator (C++ only)
  • Unary expressions
  • Increment operator ++
  • Decrement operator --
  • Unary plus operator +
  • Unary minus operator
  • Logical negation operator !
  • Bitwise negation operator ~
  • Address operator &
  • Indirection operator *
  • The __alignof__ operator
  • The sizeof operator
  • The typeof operator
  • Label value operator &&
  • The new operator (C++ only)
  • The delete operator (C++ only)
  • The _Pragma preprocessing operator
  • The __real__ and __imag__ operators
  • Cast expressions
  • Cast to union type (C only)
  • Binary expressions
  • Multiplication operator *
  • Division operator /
  • Remainder operator %
  • Addition operator +
  • Subtraction operator -
  • Bitwise left and right shift operators << >>
  • Relational operators < > <= >=
  • Equality and inequality operators == !=
  • Bitwise AND operator &
  • Bitwise exclusive OR operator ^
  • Bitwise inclusive OR operator |
  • Logical AND operator &&
  • Logical OR operator ||
  • Pointer to member operators .* ->* (C++ only)
  • Conditional expressions
  • Types in conditional C expressions
  • Types in conditional C++ expressions
  • Examples of conditional expressions
  • Assignment expressions
  • Simple assignment operator =
  • Compound assignment operators
  • Comma expressions
  • throw expressions (C++ only)
  • Operator precedence and associativity
  • Examples of expressions and precedence
  • Statements

  • Labeled statements
  • Locally declared labels
  • Labels as values
  • Expression statements
  • Resolution of ambiguous statements
  • Block statements
  • Example of blocks
  • Statement expressions
  • Selection statements
  • The if statement
  • The switch statement
  • Iteration statements
  • The while statement
  • The do statement
  • The for statement
  • Jump statements
  • The break statement
  • The continue statement
  • The return statement
  • The goto statement
  • Null statement
  • Inline assembly statements
  • Examples of inline assembly statements
  • Restrictions on inline assembly statements
  • Functions

  • Function declarations and definitions
  • Function declarations
  • Function definitions
  • Examples of function declarations
  • Examples of function definitions
  • Compatible functions
  • Multiple function declarations
  • Function storage class specifiers
  • The static storage class specifier
  • The extern storage class specifier
  • Function specifiers
  • The inline function specifier
  • Function return type specifiers
  • Function return values
  • Function declarators
  • Parameter declarations
  • Function attributes
  • The alias function attribute
  • The always_inline function attribute
  • The const function attribute
  • The constructor and destructor function attributes
  • The format function attribute
  • The format_arg function attribute
  • The noinline function attribute
  • The noreturn function attribute
  • The pure function attribute
  • The section function attribute
  • The weak function attribute
  • The main() function
  • Function calls
  • Pass by value
  • Pass by reference
  • Default arguments in C++ functions
  • Restrictions on default arguments
  • Evaluation of default arguments
  • Pointers to functions
  • Nested functions
  • Namespaces (C++ only)

  • Defining namespaces (C++ only)
  • Declaring namespaces (C++ only)
  • Creating a namespace alias (C++ only)
  • Creating an alias for a nested namespace (C++ only)
  • Extending namespaces (C++ only)
  • Namespaces and overloading (C++ only)
  • Unnamed namespaces (C++ only)
  • Namespace member definitions (C++ only)
  • Namespaces and friends (C++ only)
  • The using directive (C++ only)
  • The using declaration and namespaces (C++ only)
  • Explicit access (C++ only)
  • Overloading (C++ only)

  • Overloading functions (C++ only)
  • Restrictions on overloaded functions (C++ only)
  • Overloading operators (C++ only)
  • Overloading unary operators (C++ only)
  • Overloading increment and decrement operators (C++ only)
  • Overloading binary operators (C++ only)
  • Overloading assignments (C++ only)
  • Overloading function calls (C++ only)
  • Overloading subscripting (C++ only)
  • Overloading class member access (C++ only)
  • Overload resolution (C++ only)
  • Implicit conversion sequences (C++ only)
  • Resolving addresses of overloaded functions (C++ only)
  • Classes (C++ only)

  • Declaring class types (C++ only)
  • Using class objects (C++ only)
  • Classes and structures (C++ only)
  • Scope of class names (C++ only)
  • Incomplete class declarations (C++ only)
  • Nested classes (C++ only)
  • Local classes (C++ only)
  • Local type names (C++ only)
  • Class members and friends (C++ only)

  • Class member lists (C++ only)
  • Data members (C++ only)
  • Member functions (C++ only)
  • Inline member functions (C++ only)
  • Constant and volatile member functions (C++ only)
  • Virtual member functions (C++ only)
  • Special member functions (C++ only)
  • Member scope (C++ only)
  • Pointers to members (C++ only)
  • The this pointer (C++ only)
  • Static members (C++ only)
  • Using the class access operators with static members (C++ only)
  • Static data members (C++ only)
  • Static member functions (C++ only)
  • Member access (C++ only)
  • Friends (C++ only)
  • Friend scope (C++ only)
  • Friend access (C++ only)
  • Inheritance (C++ only)

  • Derivation (C++ only)
  • Inherited member access (C++ only)
  • Protected members (C++ only)
  • Access control of base class members (C++ only)
  • The using declaration and class members (C++ only)
  • Overloading member functions from base and derived classes (C++ only)
  • Changing the access of a class member (C++ only)
  • Multiple inheritance (C++ only)
  • Virtual base classes (C++ only)
  • Multiple access (C++ only)
  • Ambiguous base classes (C++ only)
  • Virtual functions (C++ only)
  • Ambiguous virtual function calls (C++ only)
  • Virtual function access (C++ only)
  • Abstract classes (C++ only)
  • Special member functions (C++ only)

  • Overview of constructors and destructors (C++ only)
  • Constructors (C++ only)
  • Default constructors (C++ only)
  • Explicit initialization with constructors (C++ only)
  • Initializing base classes and members (C++ only)
  • Construction order of derived class objects (C++ only)
  • Destructors (C++ only)
  • Pseudo-destructors (C++ only)
  • Free store (C++ only)
  • Temporary objects (C++ only)
  • User-defined conversions (C++ only)
  • Conversion by constructor (C++ only)
  • The explicit specifier (C++ only)
  • Conversion functions (C++ only)
  • Copy constructors (C++ only)
  • Copy assignment operators (C++ only)
  • Templates (C++ only)

  • Template parameters (C++ only)
  • Type template parameters (C++ only)
  • Non-type template parameters (C++ only)
  • Template template parameters (C++ only)
  • Default arguments for template parameters (C++ only)
  • Template arguments (C++ only)
  • Template type arguments (C++ only)
  • Template non-type arguments (C++ only)
  • Template template arguments (C++ only)
  • Class templates (C++ only)
  • Class template declarations and definitions (C++ only)
  • Static data members and templates (C++ only)
  • Member functions of class templates (C++ only)
  • Friends and templates (C++ only)
  • Function templates (C++ only)
  • Template argument deduction (C++ only)
  • Overloading function templates (C++ only)
  • Partial ordering of function templates (C++ only)
  • Template instantiation (C++ only)
  • Implicit instantiation (C++ only)
  • Explicit instantiation (C++ only)
  • Template specialization (C++ only)
  • Explicit specialization (C++ only)
  • Partial specialization (C++ only)
  • Name binding and dependent names (C++ only)
  • The typename keyword (C++ only)
  • The template keyword as qualifier (C++ only)
  • Exception handling (C++ only)

  • try blocks (C++ only)
  • Nested try blocks (C++ only)
  • catch blocks (C++ only)
  • Function try block handlers (C++ only)
  • Arguments of catch blocks (C++ only)
  • Matching between exceptions thrown and caught (C++ only)
  • Order of catching (C++ only)
  • throw expressions (C++ only)
  • Rethrowing an exception (C++ only)
  • Stack unwinding (C++ only)
  • Exception specifications (C++ only)
  • Special exception handling functions (C++ only)
  • The unexpected() function (C++ only)
  • The terminate() function (C++ only)
  • The set_unexpected() and set_terminate() functions (C++ only)
  • Example using the exception handling functions (C++ only)
  • Preprocessor Directives

  • Macro definition directives
  • The #define directive
  • The #undef directive
  • The # operator
  • The ## operator
  • Standard predefined macro names
  • File inclusion directives
  • The #include directive
  • The #include_next directive
  • Conditional compilation directives
  • The #if and #elif directives
  • The #ifdef directive
  • The #ifndef directive
  • The #else directive
  • The #endif directive
  • Examples of conditional compilation directives
  • Message generation directives
  • The #error directive
  • The #warning directive
  • The #line directive
  • Assertion directives
  • Predefined assertions
  • The null directive (#)
  • Pragma directives
  • Standard pragmas
  • Appendix A. The IBM XL C language extensions

  • C99 features as extensions to C89
  • Extensions for Unicode support
  • Extensions for GNU C compatibility
  • Extensions for VMX support
  • Appendix B. The IBM XL C++ language extensions

  • General IBM extensions
  • Extensions for C99 compatibility
  • Extensions for Unicode support
  • Extensions for GNU C compatibility
  • Extensions for GNU C++ compatibility
  • Extensions for VMX support
  • Appendix C. Vector data types and literals

    Index