Contents

About This Reference

  • Supported language standards
  • The IBM language extensions
  • Features related to GNU C and C++
  • Extensions supporting the AltiVec Programming Interface
  • Document conventions
  • Highlighting conventions
  • Examples
  • How to read the syntax diagrams
  • Scope and Linkage

  • Scope
  • Local Scope
  • Function Scope
  • Function Prototype Scope
  • Global Scope
  • Class Scope
  • Name Spaces of Identifiers
  • Name Hiding
  • Program Linkage
  • Internal Linkage
  • External Linkage
  • No Linkage
  • Linkage Specifications -- Linking to Non-C++ Programs
  • Name Mangling
  • Lexical Elements

  • Tokens
  • Punctuators
  • Alternative Tokens
  • Source Program Character Set
  • Escape Sequences
  • The Unicode Standard
  • Trigraph Sequences
  • Multibyte Characters
  • Comments
  • Identifiers
  • Reserved Identifiers
  • Case Sensitivity and Special Characters in Identifiers
  • Predefined Identifiers
  • Keywords
  • Keywords for Language Extensions
  • Alternative Representations of Operators and Punctuators
  • Literals
  • Boolean Literals
  • Integer Literals
  • Decimal Integer Literals
  • Hexadecimal Integer Literals
  • Octal Integer Literals
  • Floating-Point Literals
  • Hexadecimal Floating Constants
  • Complex Literals
  • Character Literals
  • String Literals
  • Compound Literals
  • Vector Literals
  • Declarations

  • Declaration Overview
  • Variable Attributes
  • The aligned Variable Attribute
  • The init_priority Variable Attribute
  • The mode Variable Attribute
  • The packed Variable Attribute
  • The weak Variable Attribute
  • The __align Specifier
  • Tentative Definitions
  • Objects
  • Storage Class Specifiers
  • auto Storage Class Specifier
  • extern Storage Class Specifier
  • mutable Storage Class Specifier
  • register Storage Class Specifier
  • static Storage Class Specifier
  • typedef
  • Type Specifiers
  • Type Names
  • Type Attributes
  • Type Attribute aligned
  • Type Attribute packed
  • Type Attribute transparent_union
  • Compatible Types
  • Simple Type Specifiers
  • Boolean Variables
  • char and wchar_t Type Specifiers
  • The wchar_t Type Specifier
  • Floating-Point Variables
  • Integer Variables
  • void Type
  • Compound Types
  • Structures
  • Declaring and Defining a Structure
  • Defining a Structure Variable
  • Initializing Structures
  • Declaring Structure Types and Variables in the Same Statement
  • Alignment of Structures
  • Declaring and Using Bit Fields in Structures
  • Example Program Using Structures
  • Unions
  • Declaring a Union
  • Defining a Union Variable
  • Anonymous Unions
  • Examples of Unions
  • Enumerations
  • Declaring an Enumeration Data Type
  • Enumeration Constants
  • Defining Enumeration Variables
  • Defining an Enumeration Type and Enumeration Objects
  • Example Program Using Enumerations
  • Complex Types
  • Type Qualifiers
  • The const Type Qualifier
  • The volatile Type Qualifier
  • The restrict Type Qualifier
  • The asm Statement
  • Incomplete Types
  • AltiVec Types
  • Declarators

  • Initializers
  • Pointers
  • Declaring Pointers
  • Assigning Pointers
  • Initializing Pointers
  • Using Pointers
  • Pointer Arithmetic
  • Example Program Using Pointers
  • Arrays
  • Declaring Arrays
  • Variable Length Arrays
  • Initializing Arrays
  • Initializing Arrays Using Designated Initializers
  • Example Programs Using Arrays
  • Function Specifiers
  • References
  • Initializing References
  • Expressions and Operators

  • Operator Precedence and Associativity
  • Examples of Expressions and Precedence
  • Lvalues and Rvalues
  • Primary Expressions
  • Identifier Expressions
  • Integer Constant Expressions
  • Parenthesized Expressions ( )
  • C++ Scope Resolution Operator ::
  • Postfix Expressions
  • Function Call Operator ( )
  • Array Subscripting Operator [ ]
  • Dot Operator .
  • Arrow Operator ->
  • The typeid Operator
  • static_cast Operator
  • reinterpret_cast Operator
  • const_cast Operator
  • dynamic_cast Operator
  • Unary Expressions
  • Increment ++
  • Decrement --
  • Unary Plus +
  • Unary Minus -
  • Logical Negation !
  • Bitwise Negation ~
  • Address &
  • Indirection *
  • alignof Operator
  • sizeof Operator
  • typeof Operator
  • Label Value Operator &&
  • C++ new Operator
  • Initializing Objects Created with the new Operator
  • set_new_handler() -- Set Behavior for new Failure
  • C++ delete Operator
  • Cast Expressions
  • Cast to a Union Type
  • Binary Expressions
  • Multiplication *
  • Division /
  • Remainder %
  • Addition +
  • Subtraction -
  • Bitwise Left and Right Shift << >>
  • Relational < > <= >=
  • Equality == !=
  • Bitwise AND &
  • Bitwise Exclusive OR ^
  • Bitwise Inclusive OR |
  • Logical AND &&
  • Logical OR ||
  • C++ Pointer to Member Operators .* ->*
  • Conditional Expressions
  • Type of Conditional C Expressions
  • Type of Conditional C++ Expressions
  • Examples of Conditional Expressions
  • Assignment Expressions
  • Simple Assignment =
  • Compound Assignment
  • Comma Expressions
  • C++ throw Expressions
  • Implicit Type Conversions

  • Integral and Floating-Point Promotions
  • Standard Type Conversions
  • Lvalue-to-Rvalue Conversions
  • Boolean Conversions
  • Integral Conversions
  • Floating-Point Conversions
  • Pointer Conversions
  • Reference Conversions
  • Pointer-to-Member Conversions
  • Qualification Conversions
  • Function Argument Conversions
  • Other Conversions
  • Arithmetic Conversions
  • The explicit Keyword
  • Functions

  • C++ Enhancements to C Functions
  • Function Declarations
  • C++ Function Declarations
  • Multiple Function Declarations
  • Parameter Names in Function 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
  • Examples of Function Declarations
  • Function Definitions
  • Ellipsis and void
  • Examples of Function Definitions
  • The main() Function
  • Arguments to main
  • Example of Arguments to main
  • Calling Functions and Passing Arguments
  • Passing Arguments by Value
  • Passing Arguments by Reference
  • Default Arguments in C++ Functions
  • Restrictions on Default Arguments
  • Evaluating Default Arguments
  • Function Return Values
  • Using References as Return Types
  • Allocation and Deallocation Functions
  • Pointers to Functions
  • Inline Functions
  • Nested Functions
  • Statements

  • Labels
  • Locally Declared Labels
  • Labels as Values
  • Expression Statements
  • Resolving Ambiguous Statements in C++
  • Block Statement
  • Statement Expressions
  • if Statement
  • switch Statement
  • while Statement
  • do Statement
  • for Statement
  • break Statement
  • continue Statement
  • return Statement
  • Value of a return Expression and Function Value
  • goto Statement
  • Computed goto
  • Null Statement
  • Preprocessor Directives

  • Preprocessor Overview
  • Preprocessor Directive Format
  • Macro Definition and Expansion (#define)
  • Object-Like Macros
  • Function-Like Macros
  • Variadic Macro Extensions
  • Scope of Macro Names (#undef)
  • # Operator
  • Macro Concatenation with the ## Operator
  • Preprocessor Error Directive (#error)
  • Preprocessor Warning Directive (#warning)
  • File Inclusion (#include)
  • Specialized File Inclusion (#include_next)
  • ISO Standard Predefined Macro Names
  • Conditional Compilation Directives
  • #if, #elif
  • #ifdef
  • #ifndef
  • #else
  • #endif
  • Examples of Conditional Compilation Directives
  • Line Control (#line)
  • Null Directive (#)
  • Pragma Directives (#pragma)
  • Standard Pragmas
  • The _Pragma Operator
  • Namespaces

  • Defining Namespaces
  • Declaring Namespaces
  • Creating a Namespace Alias
  • Creating an Alias for a Nested Namespace
  • Extending Namespaces
  • Namespaces and Overloading
  • Unnamed Namespaces
  • Namespace Member Definitions
  • Namespaces and Friends
  • Using Directive
  • The using Declaration and Namespaces
  • Explicit Access
  • Overloading

  • Overloading Functions
  • Restrictions on Overloaded Functions
  • Overloading Operators
  • Overloading Unary Operators
  • Overloading Increment and Decrement
  • Overloading Binary Operators
  • Overloading Assignments
  • Overloading Function Calls
  • Overloading Subscripting
  • Overloading Class Member Access
  • Overload Resolution
  • Implicit Conversion Sequences
  • Resolving Addresses of Overloaded Functions
  • Classes

  • Declaring Class Types
  • Using Class Objects
  • Classes and Structures
  • Scope of Class Names
  • Incomplete Class Declarations
  • Nested Classes
  • Local Classes
  • Local Type Names
  • Class Members and Friends

  • Class Member Lists
  • Data Members
  • Member Functions
  • const and volatile Member Functions
  • Virtual Member Functions
  • Special Member Functions
  • Member Scope
  • Pointers to Members
  • The this Pointer
  • Static Members
  • Using the Class Access Operators with Static Members
  • Static Data Members
  • Static Member Functions
  • Member Access
  • Friends
  • Friend Scope
  • Friend Access
  • Inheritance

  • Derivation
  • Inherited Member Access
  • Protected Members
  • Access Control of Base Class Members
  • The using Declaration and Class Members
  • Overloading Member Functions from Base and Derived Classes
  • Changing the Access of a Class Member
  • Multiple Inheritance
  • Virtual Base Classes
  • Multiple Access
  • Ambiguous Base Classes
  • Virtual Functions
  • Ambiguous Virtual Function Calls
  • Virtual Function Access
  • Abstract Classes
  • Special Member Functions

  • Constructors and Destructors Overview
  • Constructors
  • Default Constructors
  • Explicit Initialization with Constructors
  • Initializing Base Classes and Members
  • Construction Order of Derived Class Objects
  • Destructors
  • Free Store
  • Temporary Objects
  • User-Defined Conversions
  • Conversion by Constructor
  • Conversion Functions
  • Copy Constructors
  • Copy Assignment Operators
  • Templates

  • Template Parameters
  • Type Template Parameters
  • Non-Type Template Parameters
  • Template Template Parameters
  • Default Arguments for Template Parameters
  • Template Arguments
  • Template Type Arguments
  • Template Non-Type Arguments
  • Template Template Arguments
  • Class Templates
  • Class Template Declarations and Definitions
  • Static Data Members and Templates
  • Member Functions of Class Templates
  • Friends and Templates
  • Function Templates
  • Template Argument Deduction
  • Deducing Type Template Arguments
  • Deducing Non-Type Template Arguments
  • Overloading Function Templates
  • Partial Ordering of Function Templates
  • Template Instantiation
  • Implicit Instantiation
  • Explicit Instantiation
  • Template Specialization
  • Explicit Specialization
  • Definition and Declaration of Explicit Specializations
  • Explicit Specialization and Scope
  • Class Members of Explicit Specializations
  • Explicit Specialization of Function Templates
  • Explicit Specialization of Members of Class Templates
  • Partial Specialization
  • Template Parameter and Argument Lists of Partial Specializations
  • Matching of Class Template Partial Specializations
  • Name Binding and Dependent Names
  • The typename Keyword
  • The Keyword template as Qualifier
  • Exception Handling

  • The try Keyword
  • Nested Try Blocks
  • catch Blocks
  • Function try block Handlers
  • Arguments of catch Blocks
  • Matching between Exceptions Thrown and Caught
  • Order of Catching
  • The throw Expression
  • Rethrowing an Exception
  • Stack Unwinding
  • Exception Specifications
  • Special Exception Handling Functions
  • unexpected()
  • terminate()
  • set_unexpected() and set_terminate()
  • Example Using the Exception Handling Functions
  • Appendix A. The IBM C Language Extensions

  • Orthogonal Extensions
  • Existing IBM C Extensions with Individual Option Controls
  • IBM C Extensions: C99 Features as Extensions to C89
  • IBM C Extensions Related to GNU C
  • Non-Orthogonal Extensions
  • Existing IBM C Extensions with Individual Option Controls
  • IBM C Extensions: C99 Features as Extensions to C89
  • IBM C Extensions Related to GNU C
  • Extensions for AltiVec Programming Interface Support
  • Appendix B. The IBM C++ Language Extensions

  • Orthogonal Extensions
  • IBM C++ Extensions for Compatibility with C99
  • IBM C++ Extensions Related to GNU C
  • IBM C++ Extensions Related to GNU C++
  • Non-Orthogonal Extensions
  • IBM C++ Extensions for Compatibility with C99
  • IBM C++ Extensions Related to GNU C
  • Appendix C. AltiVec Data Types and Literals

  • Vector Data Types
  • Vector Literals
  • Index

    IBM Copyright 2003