You are previewing Microsoft® Visual C++® .NET Language Reference.
O'Reilly logo
Microsoft® Visual C++® .NET Language Reference

Book Description

Here’s official documentation for the Visual C++® .NET language, including descriptions of all major features. Covers modifiers, statements, operators, attributes, declarations, namespaces, classes, managed extensions keywords, compiler options, and more.

Table of Contents

  1. Microsoft® Visual C++® .NET: Language Reference
  2. 1. Introduction to Visual C++ .NET
  3. 2. Keywords, Modifiers and Statements
    1. Keywords A-Z
      1. __alignof Operator
      2. __asm
        1. Grammar
        2. Example
      3. __assume
        1. Example
        2. Remarks
      4. _based
        1. Example
        2. Output
      5. __cdecl
        1. Example
      6. __declspec
        1. Grammar
      7. __event
        1. Remarks
        2. Native Events
        3. COM Events
        4. Managed Events
          1. Example: Native Events
          2. Example: COM Events
          3. Example: Managed Events
      8. __except
        1. try-except Statement
          1. Grammar
        2. Structured Exception Handling Intrinsic Functions
          1. Example
      9. __fastcall
        1. Example
      10. __finally
        1. try-finally Statement
          1. Grammar
        2. Order of Termination-Handler Execution
          1. The __leave keyword
          2. Abnormal Termination
      11. __forceinline
        1. inline, __inline, __forceinline
          1. Example 1
          2. Example 2
      12. __hook
        1. Parameters
        2. Usage
        3. Remarks
      13. __identifier
        1. Remarks
        2. Example
      14. __if_exists
        1. Remarks
        2. Example
        3. Output
      15. __if_not_exists Statement
        1. Remarks
        2. Example
      16. __inline
        1. inline, __inline, __forceinline
          1. Example 1
          2. Example 2
      17. __int8, __int16, __int32, __int64
        1. Example
        2. Output
      18. __interface
        1. Example
        2. Output
      19. __leave
        1. try-finally Statement
          1. Grammar
        2. The __leave keyword
        3. Order of Termination-Handler Execution
          1. Abnormal Termination
      20. __m64
      21. __m128
      22. __m128d
      23. __m128i
      24. __multiple_inheritance
      25. __noop
      26. __raise
        1. Remarks
      27. __single_inheritance
      28. __stdcall
        1. Example
      29. __super
        1. Example
      30. __unhook
        1. Parameters
        2. Usage
        3. Remarks
      31. __uuidof
      32. __virtual_inheritance
      33. __w64
        1. Remarks
        2. Example
      34. bool
        1. Example
        2. Output
      35. break
      36. case
        1. The switch Statement
          1. Switch Statement Behavior
      37. catch
        1. The try, catch, and throw Statements
          1. Grammar
          2. Example
          3. Output
      38. char
        1. Fundamental Types of the C++ Language
        2. Sizes of Fundamental Types
      39. class
        1. Example
      40. const
      41. const_cast
        1. Grammar
        2. Example
      42. continue
        1. Output
      43. default
        1. The switch Statement
          1. Switch Statement Behavior
      44. delete
        1. Grammar
        2. Example
      45. deprecated
        1. Example
        2. Output
      46. dllexport, dllimport
        1. Example
      47. do
        1. The do-while Statement
      48. double
        1. Fundamental Types of the C++ Language
        2. Sizes of Fundamental Types
      49. dynamic_cast Operator
        1. Grammar
      50. else
        1. The if-else Statement
      51. enum
        1. C++ Enumeration Declarations
          1. Example
          2. Output
          3. Grammar
      52. explicit
      53. extern
        1. Using extern to Specify Linkage
          1. Grammar
          2. Example 1
          3. Example 2
      54. false
      55. float
        1. Fundamental Types of the C++ Language
          1. Sizes of Fundamental Types
      56. for
        1. for Loop Elements
        2. for Loops and the C++ Standard
      57. friend
      58. goto
        1. Grammar
      59. if
        1. The if-else Statement
      60. inline
        1. inline, __inline, __forceinline
          1. Example 1
          2. Example 2
      61. int
        1. Fundamental Types of the C++ Language
        2. Sizes of Fundamental Types
      62. long
        1. Fundamental Types of the C++ Language
        2. Sizes of Fundamental Types
      63. mutable
      64. naked
        1. Examples
      65. namespace
        1. Grammar
      66. new
        1. Grammar
        2. Examples
      67. noinline
      68. noreturn
      69. nothrow
      70. novtable
        1. Example
        2. Output
      71. operator
        1. Operator Overloading
          1. Redefinable Operators
          2. Nonredefinable Operators
            1. Example
      72. private
        1. Example
      73. property
      74. protected
        1. Example
      75. public
        1. Example
      76. register Keyword
      77. reinterpret_cast
        1. Grammar
      78. return
      79. selectany
        1. Example 1
        2. Example 2
      80. short
        1. Fundamental Types of the C++ Language
        2. Sizes of Fundamental Types
      81. signed
        1. Fundamental Types of the C++ Language
        2. Sizes of Fundamental Types
      82. sizeof
        1. Grammar
        2. Example
        3. Output
      83. static
        1. Grammar
        2. Example 1
        3. Output
        4. Example 2
        5. Output
      84. static_cast
        1. Grammar
      85. struct
        1. Using a Structure
          1. Example 1
          2. Example 2
      86. switch
        1. Switch Statement Behavior
      87. template
        1. Template Specifications
          1. Grammar
          2. Examples
          3. Output
      88. this Pointer
        1. Example
        2. Output
      89. thread
      90. throw
        1. The try, catch, and throw Statements
          1. Grammar
          2. Example
          3. Output
      91. true
      92. try
        1. The try, catch, and throw Statements
          1. Grammar
          2. Example
          3. Output
      93. try-except
        1. Grammar
        2. Structured Exception Handling Intrinsic Functions
          1. Example
          2. Output
      94. try-finally
        1. Grammar
        2. Order of Termination-Handler Execution
          1. The __leave keyword
          2. Abnormal Termination
      95. typedef
        1. Examples
        2. Output
      96. typeid
        1. Grammar
      97. typename
      98. union
        1. Declaring a Union
        2. Using a Union
          1. Example
          2. Output
      99. unsigned
        1. Fundamental Types of the C++ Language
        2. Sizes of Fundamental Types
      100. using Declaration
        1. Grammar
        2. Output
        3. Output
        4. Output
      101. Post-declaration Namespace Additions
        1. Functions in Namespaces
        2. Inheritance
          1. Output
      102. using Directive
        1. Grammar
        2. Example
        3. Output
        4. The std namespace
      103. uuid
      104. Virtual
      105. Void
        1. Fundamental Types of the C++ Language
        2. Sizes of Fundamental Types
          1. Example
      106. volatile
      107. while
    2. Controlling Access to Class Members
      1. Member-Access Control
    3. Microsoft-Specific Modifiers
      1. Microsoft-Specific Keywords
      2. Based Addressing
        1. Based Pointers__based Grammar
          1. Grammar
        2. Based Pointers
      3. __cdecl
        1. Example
      4. __stdcall
        1. Example
      5. __fastcall
        1. Example
      6. __declspec
        1. Grammar
        2. deprecated
        3. dllexport, dllimport
        4. naked
        5. noinline
        6. noreturn
        7. nothrow
        8. novtable
          1. Example
          2. Output
        9. property
        10. selectany
          1. Example
          2. Example
        11. thread
        12. uuid
      7. __w64
        1. Remarks
    4. Statements
      1. Overview of C++ Statements
        1. Grammar
      2. Labeled Statements
        1. Grammar
        2. Using Labels with the goto Statement
          1. Output
      3. Expression Statements
        1. Grammar
      4. Null Statements
      5. Compound Statements (Blocks)
        1. Grammar
      6. Selection Statements
        1. Grammar
        2. The if-else Statement
        3. The __if_exists Statement
          1. Remarks
        4. The __if_not_exists Statement
          1. Remarks
          2. Example
        5. The switch Statement
          1. Switch Statement Behavior
      7. Iteration Statements
        1. Iteration Statements
        2. The while Statement
        3. The do-while Statement
        4. The for Statement
          1. for Loop Elements
          2. for Loops and the C++ Standard
      8. Jump Statements
        1. Grammar
        2. The break Statement
        3. The continue Statement
          1. Output
        4. The return Statement
        5. The goto Statement
          1. Grammar
      9. Declaration Statements
        1. Grammar
        2. Declaration of Automatic Objects
          1. Initialization of Automatic Objects
          2. Destruction of Automatic Objects
          3. Transfers of Control
        3. Declaration of Static Objects
          1. Initialization of Static Objects
          2. Destruction of Static Objects
  4. 3. C++ Features
    1. Operator Overloading
      1. Redefinable Operators
      2. General Rules for Operator Overloading
        1. Nonredefinable Operators
          1. Example
    2. C++ Operators
      1. Additive Operators: + and –
        1. Grammar
        2. Types Used with Additive Operators
          1. Example
      2. Assignment Operators: =, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, and |=
        1. Grammar
        2. Assignment Operators
        3. Operator Keywords
          1. Example
          2. Grammar
        4. Operator Keyword for &
          1. Example
      3. Bitwise Exclusive OR Operator: ^
        1. Grammar
        2. Operator Keyword for^
          1. Example
      4. Bitwise Inclusive OR Operator: |
        1. Grammar
        2. Operator Keyword for |
          1. Example
      5. Comma Operator: ,
      6. Conditional Operator: ? :
        1. Grammar
        2. Example
      7. Logical AND Operator: &&
        1. Grammar
        2. Operator Keyword for &&
          1. Example
      8. Logical OR Operator: ||
        1. Grammar
        2. Operator Keyword for ||
          1. Example
      9. Multiplicative Operators: *, /, and %
        1. Grammar
        2. Example
      10. Pointer-to-Member Operators: .* and ->*
        1. Grammar
        2. Output
        3. Example
      11. Subscript Operator: []
        1. Grammar
      12. Function Call Operator: ()
        1. Grammar
        2. Example
      13. Cast Operator: ()
        1. Grammar
        2. Example
      14. Member Access Operators: . and ->
        1. Grammar
        2. Example
      15. Postfix Increment and Decrement Operators: ++ and --
        1. Grammar
      16. Reference Operator: &
        1. Grammar
        2. Example
      17. Relational Operators: <, >, <=, and >=
        1. Grammar
        2. Example
      18. Equality Operators: == and !=
        1. Grammar
        2. Operator Keyword for !=
          1. Example
      19. Scope Resolution Operator: ::
        1. Example
      20. Shift Operators: >> and <<
        1. Grammar
        2. Example
      21. Indirection Operator: *
        1. Grammar
      22. Address-of Operator: &
        1. Grammar
        2. Example
        3. Output
        4. Output
      23. Logical Negation Operator: !
        1. Grammar
        2. Operator Keyword for !
          1. Example
      24. One’s Complement Operator: ~
        1. Grammar
        2. Operator Keyword for ~
          1. Example
      25. Prefix Increment and Decrement Operators: ++ and --
        1. Grammar
      26. sizeof Operator
        1. Grammar
        2. Example
        3. Output
      27. delete Operator
        1. Grammar
        2. Example
      28. new Operator
        1. Grammar
        2. Examples
    3. Attributed Programming
    4. Attributes Alphabetical Reference
      1. aggregatable
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. ATL Projects
        5. Example
      2. aggregates
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. ATL Projects
        5. Example
      3. appobject
        1. Attribute Context
        2. Remarks
        3. Example
      4. async_uuid
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      5. bindable
        1. Attribute Context
        2. Remarks
        3. Example
      6. call_as
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      7. case
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      8. coclass
        1. Attribute Context
        2. Remarks
        3. Example
      9. com_interface_entry
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      10. control
        1. Attribute Context
        2. Remarks
        3. Example
      11. cpp_quote
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      12. custom
        1. Parameters
        2. Attribute Context
        3. Remarks
      13. db_accessor
        1. Parameters
        2. Attribute Context
        3. Example
      14. db_column
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. Example
      15. db_command
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. Examples
      16. db_param
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. Example
      17. db_source
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. Examples
      18. db_table
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. Example
      19. default
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. Example
      20. defaultbind
        1. Attribute Context
        2. Remarks
        3. Example
      21. defaultcollelem
        1. Attribute Context
        2. Remarks
        3. Example
      22. defaultvalue
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      23. defaultvtable
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      24. dispinterface
        1. Attribute Context
        2. Remarks
        3. Example
      25. displaybind
        1. Attribute Context
        2. Remarks
        3. Example
      26. dual
        1. Attribute Context
        2. Remarks
        3. Example
      27. emitidl
        1. Parameters
        2. Attribute Context
        3. Remarks
      28. entry
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      29. event_receiver
        1. Parameters
        2. Attribute Context
        3. Remarks
      30. event_source
        1. Parameter
        2. Attribute Context
        3. Remarks
      31. export
        1. Attribute Context
        2. Remarks
        3. Example
      32. first_is
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      33. helpcontext
        1. Parameter
        2. Attribute Context
        3. Remarks
      34. helpfile
        1. Parameter
        2. Attribute Context
        3. Remarks
      35. helpstring
        1. Parameter
        2. Attribute Context
        3. Remarks
      36. helpstringcontext
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      37. helpstringdll
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      38. hidden
        1. Attribute Context
        2. Remarks
      39. id
        1. Parameter
        2. Attribute Context
        3. Remarks
      40. idl_module
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. Example
      41. idl_quote
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      42. iid_is
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      43. immediatebind
        1. Attribute Context
        2. Remarks
      44. implements_category
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      45. import
        1. Parameter
        2. Attribute Context
        3. Remarks
      46. importidl
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      47. importlib
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      48. in
        1. Attribute Context
        2. Remarks
      49. include
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      50. includelib
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      51. last_is
        1. Parameter
        2. Attribute Context
        3. Remarks
      52. lcid
        1. Attribute Context
        2. Remarks
        3. Example
      53. length_is
        1. Parameter
        2. Attribute Context
        3. Remarks
      54. library_block
        1. Attribute Context
        2. Remarks
        3. Example
      55. licensed
        1. Attribute Context
        2. Remarks
        3. Example
      56. local
        1. Attribute Context
        2. Remarks
      57. max_is
        1. Parameter
        2. Attribute Context
        3. Remarks
      58. module
        1. Parameters
        2. Attribute Context
        3. Remarks
      59. ms_union
        1. Attribute Context
        2. Remarks
        3. Example
      60. no_injected_text
        1. Parameter
        2. Attribute Context
        3. Remarks
      61. nonbrowsable
        1. Attribute Context
        2. Remarks
        3. Example
      62. noncreatable
        1. Attribute Context
        2. Remarks
        3. ATL Projects
        4. Example
      63. nonextensible
        1. Attribute Context
        2. Remarks
        3. Example
      64. odl
        1. Attribute Context
        2. Remarks
        3. Example
      65. object
        1. Attribute Context
        2. Remarks
      66. oleautomation
        1. Attribute Context
        2. Remarks
      67. optional
        1. Attribute Context
        2. Remarks
        3. Example
      68. out
        1. Attribute Context
        2. Remarks
      69. pointer_default
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      70. pragma
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      71. progid
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. ATL Projects
        5. Example
      72. propget
        1. Attribute Context
        2. Remarks
      73. propput
        1. Attribute Context
        2. Remarks
      74. propputref
        1. Attribute Context
        2. Remarks
        3. Example
      75. ptr
        1. Attribute Context
        2. Remarks
      76. public
        1. Attribute Context
        2. Remarks
        3. Example
      77. range
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. Example
      78. rdx
        1. Parameters
        2. Attribute Context
        3. Remarks
        4. Example
      79. readonly
        1. Attribute Context
        2. Remarks
        3. Example
      80. ref
        1. Attribute Context
        2. Remarks
        3. Example
      81. registration_script
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      82. requestedit
        1. Attribute Context
        2. Remarks
        3. Example
      83. requires_category
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      84. restricted
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      85. retval
        1. Attribute Context
        2. Remarks
        3. Example
      86. satype
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      87. size_is
        1. Parameter
        2. Attribute Context
        3. Remarks
      88. source
        1. Parameter
        2. Attribute Context
        3. Remarks
      89. string
        1. Attribute Context
        2. Remarks
        3. Example
      90. support_error_info
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      91. switch_is
        1. Attribute Context
        2. Remarks
      92. switch_type
        1. Attribute Context
        2. Remarks
        3. Example
      93. synchronize
        1. Attribute Context
        2. Remarks
        3. Example
      94. threading
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. ATL Projects
        5. Example
      95. transmit_as
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      96. uidefault
        1. Attribute Context
        2. Remarks
        3. Example
      97. unique
        1. Attribute Context
        2. Remarks
      98. usesgetlasterror
        1. Attribute Context
        2. Remarks
      99. uuid
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. Example
      100. v1_enum
        1. Attribute Context
        2. Remarks
        3. Example
      101. vararg
        1. Attribute Context
        2. Remarks
        3. Example
      102. version
        1. Parameter
        2. Attribute Context
        3. Remarks
      103. vi_progid
        1. Parameter
        2. Attribute Context
        3. Remarks
        4. ATL Projects
      104. wire_marshal
        1. Attribute Context
        2. Remarks
        3. Example
    5. Declarations
      1. Grammar
      2. Specifiers
        1. Grammar
        2. Storage-Class Specifiers
          1. Grammar
        3. Automatic Storage-Class Specifiers
        4. auto Keyword
        5. register Keyword
        6. Static Storage-Class Specifiers
        7. Use of static and extern
        8. Names Without Storage-Class Specifiers
        9. Function Specifiers
        10. inline, __inline, __forceinline
          1. Example 1
          2. Example 2
        11. Inline Class Member Functions
          1. Example
        12. Inline Functions versus Macros
          1. Example
          2. Input
          3. Sample Output
          4. Example
          5. Input
          6. Sample Output
        13. When to Use Inline Functions
          1. Example
        14. virtual Specifier
          1. typedef Specifier
          2. Example
          3. Examples
          4. Output
        15. Redeclaration of typedef Names
        16. Use of typedef with Class Types
        17. Name Space of typedef Names
        18. friend Specifier
        19. C++ Type Specifiers
          1. Grammar
        20. Simple Type Names
          1. Grammar
        21. Type Name Combinations
        22. Elaborated Type Specifiers
          1. Grammar
          2. Example 1: Legal Type Specification
          3. Example 2: Legal Type Specification
          4. Example 3: Legal Type Specification
          5. Example 4: Illegal Type Specification
          6. Example 5: Illegal Type Specification
          7. Example 6: Illegal Type Specification
        23. Nested Type Names
          1. Grammar
          2. Example
          3. Example
      3. const
        1. Constant Values
          1. Output
        2. C and C++ const Differences
        3. Constant Member Functions
          1. Example
      4. volatile
    6. C++ Enumeration Declarations
      1. Example
      2. Output
      3. Grammar
      4. Enumerator Names
      5. Definition of Enumerator Constants
      6. Conversions and Enumerated Types
        1. Output
    7. Linkage Specifications
      1. Grammar
      2. Effects of Linkage Specifications
    8. Namespaces
      1. namespace Declaration
        1. Grammar
        2. Unnamed Namespaces
      2. namespace Alias
        1. Grammar
      3. Defining namespace Members
      4. using Declaration
        1. Grammar
        2. Output
        3. Output
        4. Output
        5. Post-declaration Namespace Additions
        6. Functions in Namespaces
        7. Inheritance
          1. Output
      5. using Directive
        1. Grammar
        2. Example
        3. Output
        4. The std namespace
      6. Explicit Qualification
        1. Grammar
    9. Declarators
      1. Grammar
    10. Overview of Declarators
      1. Grammar
    11. Type Names
      1. Grammar
    12. C++ Abstract Declarators
      1. Ambiguity Resolution
      2. Pointers
        1. const and volatile Pointers
      3. References
        1. Output
      4. Reference-Type Function Arguments
      5. Reference-Type Function Returns
        1. Example
        2. Output
      6. References to Pointers
        1. Example
        2. Sample Output
      7. Pointers to Members
        1. Restrictions on Pointers to Members
        2. Pointers to Members and Virtual Functions
          1. Example
          2. Output
      8. Inheritance Keywords
      9. Arrays
        1. Example
        2. Output
        3. Using Arrays
        4. Arrays in Expressions
        5. Interpretation of Subscript Operator
        6. Indirection on Array Types
        7. Ordering of C++ Arrays
      10. Function Declarations
        1. Function Declaration Grammar
          1. Grammar
        2. Variable Argument Lists
        3. Declaring Functions That Take No Arguments
        4. Function Overloading
          1. Overloading Considerations
            1. Example
        5. Restrictions on Functions
        6. The Argument Declaration List
        7. Argument Lists in Function Prototypes (Nondefining Declaration)
        8. Argument Lists in Function Definitions
      11. Default Arguments
        1. Default Argument Expressions
        2. Other Considerations
      12. C++ Function Definitions
        1. Grammar
      13. Functions with Variable Argument Lists
        1. Output
      14. Initializers
        1. Grammar
      15. Initializing Pointers to const Objects
      16. Uninitialized Objects
      17. Initializing Static Members
      18. Initializing Aggregates
        1. Length of Aggregate-Initializer Lists
        2. Initializing Aggregates That Contain Aggregates
          1. Example
          2. Output
        3. Initializing Incomplete Types
        4. Initializing Using Constructors
        5. Initializers and Unions
      19. Initializing Character Arrays
      20. Initializing References
    13. Classes, Structures, and Unions
      1. Access Control and Constraints of Structures, Classes, and Unions
    14. Overview of Classes
      1. Grammar
      2. Defining Class Types
        1. Grammar
        2. class
          1. Example
        3. struct
          1. Using a Structure
          2. Example 1
          3. Example 2
        4. Anonymous Structures
          1. Example
          2. Output
        5. Unsized Arrays in Structures
          1. Input
        6. Anonymous Class Types
        7. Point of Class Definition
        8. Class-Type Objects
        9. Empty Classes
          1. Example
          2. Output
    15. Class Names
      1. Declaring and Accessing Class Names
      2. typedef Statements and Classes
    16. Class Members
      1. Grammar
      2. Class-Member Declaration Syntax
      3. Declaring Unsized Arrays in Member Lists
        1. Restrictions
      4. Storage of Class-Member Data
      5. Member Naming Restrictions
    17. Member Functions
      1. Overview of Member Functions
        1. Nonstatic Member Functions
      2. this Pointer
        1. Example
        2. Output
        3. Type of this Pointer
        4. Grammar
        5. Semantics of this Modifiers
      3. Static Member Functions
        1. Output
    18. Static Data Members
    19. mutable
    20. Unions
      1. Declaring a Union
      2. Using a Union
        1. Example
        2. Output
      3. Member Functions in Unions
      4. Unions as Class Types
      5. Union Member Data
      6. Anonymous Unions
        1. Example
        2. Output
    21. C++ Bit Fields
      1. Restrictions on Use of Bit Fields
    22. Nested Class Declarations
      1. Access Privileges and Nested Classes
      2. Member Functions in Nested Classes
      3. Friend Functions and Nested Classes
    23. Type Names in Class Scope
    24. Derived Classes
    25. Overview of Derived Classes
      1. Grammar
      2. Single Inheritance
      3. Multiple Inheritance
      4. Class Protocol Implementation
      5. Base Classes
    26. Multiple Base Classes
      1. Virtual Base Classes
      2. Name Ambiguities
        1. Ambiguities and Virtual Base Classes
        2. Dominance
        3. Ambiguous Conversions
          1. Ambiguous Conversion of Pointers to Base Classes
    27. Virtual Functions
      1. Output
      2. virtual
    28. Explicit Overrides
      1. Output
      2. __interface
        1. Example
        2. Output
      3. __super
        1. Example
    29. Abstract Classes
      1. Restrictions on Using Abstract Classes
    30. Summary of Scope Rules
      1. Ambiguity
      2. Global Names
      3. Names and Qualified Names
      4. Function Argument Names
      5. Constructor Initializers
    31. The Preprocessor
      1. Preprocessor Directives
        1. The #define Directive
        2. The #error Directive
        3. The #if, #elif, #else, and #endif Directives
          1. Grammar
          2. Syntax
        4. The #ifdef and #ifndef Directives
          1. Syntax
        5. The #import Directive
        6. The #include Directive
        7. The #line Directive
        8. The Null Directive
        9. The #pragma Directive
        10. The #undef Directive
        11. The #using Directive
          1. Remarks
          2. Example
      2. Preprocessor Operators
        1. Stringizing Operator (#)
        2. Charizing Operator (#@)
        3. Token-Pasting Operator (##)
      3. Macros
        1. Macros and C++
        2. Predefined Macros
          1. ANSI-Compliant Predefined Macros
          2. Microsoft-Specific Predefined Macros
          3. Values for _M_IX86
  5. 4. Managed Extensions for C++ Specification
    1. Abstract
    2. Specification Format
    3. Introduction
      1. Example
      2. Output
    4. Overview of Managed Types
    5. Managed Extensions Keywords
    6. __gc Classes
      1. Example
      2. Output
      3. Example
      4. Characteristics
      5. Constraints
        1. Example
        2. Output
      6. operator __gc new
        1. Characteristic
        2. Constraints
          1. Output
      7. Destructors and operator delete
        1. Example
        2. Output
        3. Example
        4. Output
        5. Characteristic
          1. Example
      8. Implementation of Destructors via Finalize
        1. Example
        2. Characteristic
        3. Constraint
      9. __nogc Classes
        1. Characteristics
        2. Constraint
      10. __gc Arrays
        1. Example
        2. Characteristics
        3. Constraints
          1. Example
          2. Output
        4. Automatic Array Initialization
        5. Function Return Syntax
          1. Example
        6. __gc and __nogc Keywords and Arrays
          1. Example
        7. Constraints
        8. Default Allocation Rules
          1. Characteristics
            1. Example
        9. Multidimensional Arrays
          1. Example
        10. Constraint
        11. Array Covariance
          1. Example
        12. Constraint
        13. Aggregate Initialization
          1. Example
          2. Output
        14. The ParamArray Attribute
          1. Example
          2. Example
          3. Example
    7. __value Classes
      1. Example
      2. Output
      3. Characteristics
        1. Output
        2. Constraints
      4. Primitive Types
      5. Boxed __value Classes
        1. __box Operation
          1. Example
        2. Boxed Type Declarations
          1. Example
        3. Characteristics
        4. Constraint
        5. Unboxing
          1. Example
        6. Calling Methods on System::ValueType
          1. Example
          2. Output
          3. Example
          4. Output
          5. Example
          6. Output
    8. __gc Interfaces
      1. Example
      2. Characteristics
      3. Constraints
      4. Implementation of Ambiguous Base Interface Methods
        1. Example
        2. Example
        3. Example
        4. Output
      5. Default Implementations
        1. Example
    9. __gc Pointers
      1. Characteristics
      2. Constraint
      3. Pointer Defaults
        1. Characteristics
          1. Example
      4. Address-of and Managed Classes
        1. Example
        2. Example
      5. Address-of and Static Members
        1. Example
        2. Output
      6. Interior vs. Whole __gc Pointers
        1. Example
        2. Characteristics
        3. Constraints
          1. Example
          2. Output
      7. Pointer Casts
        1. Constraint
        2. dynamic_cast
          1. Example
        3. Constraint
        4. __try_cast
          1. Example
          2. Output
        5. Constraint
        6. static_cast
          1. Constraint
        7. reinterpret_cast
          1. Example
          2. Output
        8. Constraint
        9. const_cast
        10. C-Style Casts
        11. Characteristics
        12. Constraint
      8. __gc Pointers and Overload Resolution
        1. Example
      9. Pinning Pointers
        1. Example
        2. Output
        3. Example
        4. Example
        5. Output
        6. Characteristics
        7. Constraints
      10. Direct Access to Characters
        1. Example
      11. __gc Pointer-to-Members
    10. __gc References
      1. Example
      2. Output
      3. Characteristic
        1. Example
        2. Output
        3. Example
        4. Output
    11. Delegates
      1. Example
      2. Example
      3. Characteristics
      4. Constraints
        1. Example
        2. Output
    12. Events
      1. Example
      2. Characteristics
        1. Example
        2. Example
        3. Output
        4. Example
        5. Example
        6. Output
    13. System::String
      1. C++ String Literals
        1. Example
      2. Runtime String Literals
        1. Example
        2. Example
        3. Output
        4. String Concatenation and Output
          1. Example
          2. Output
          3. Example
          4. Output
          5. Example
          6. Output
          7. Example
          8. Output
    14. __value Enums
      1. Characteristics
        1. Example
        2. Constraint
      2. Weak Enumerator Names
        1. Characteristic
      3. Enumerator Qualification
        1. Example
      4. Underlying Type
        1. Constraint
        2. Example
      5. Boxed enums and System::Enum
    15. Properties
      1. Example
      2. Characteristics
      3. Constraints
      4. Scalar Properties
        1. Characteristics
        2. Constraint
      5. Indexed Properties
        1. Example
        2. Output
        3. Example
        4. Output
        5. Example
        6. Output
      6. Injected Pseudo-Member
        1. Constraints
      7. Preventing Ambiguity of Array and Indexed Properties
        1. Example
        2. Example
        3. Constraint
    16. Exception Handling
      1. throw
        1. Example
      2. try/catch
        1. Example
        2. Output
        3. Constraint
          1. Example
      3. __finally Keyword
        1. Example
        2. Output
      4. Unwinding
      5. Catching Unmanaged C++ Exceptions
    17. Nested Classes
      1. Constraints
    18. Mixing Managed and Unmanaged Classes
      1. Unmanaged Classes Embedded in Managed Classes
        1. Example
        2. Example
        3. Output
        4. Constraints
      2. __nogc Pointers in Managed Classes
        1. Example
      3. __gc Pointers in Unmanaged Classes
        1. Example
        2. Output
    19. __abstract Keyword
      1. Example
      2. Characteristics
      3. Constraints
    20. __sealed Keyword
      1. Constraints
        1. Example
    21. Static Class Constructors
      1. Example
      2. Constraints
    22. Managed Operators
      1. Example
      2. Arithmetic, Logical, and Bitwise Operators
        1. Example
        2. Constraints
          1. Example
        3. Unary operators
        4. Binary operators
          1. Example
      3. Conversion Operators
        1. Convert-From Operators
          1. Constraints
            1. Example
        2. Convert-To Operators
          1. Example
          2. Example
    23. Metadata
      1. Class Visibility
        1. Example
      2. Member Visibility
        1. Characteristics
      3. Extensible Metadata
        1. Custom Attributes
          1. Example
          2. Example
          3. Example
          4. Example
          5. Example
          6. Example
        2. Declarative Security
      4. Importing Metadata with #using
        1. Example
        2. Output
        3. Characteristics
        4. Constraints
      5. Metadata as Binary Headers
        1. Characteristics
    24. __identifier Keyword
      1. Example
      2. Characteristic
      3. Constraint
    25. The __typeof Keyword
      1. Example
      2. Constraint
    26. Compiling Code for the Runtime
      1. Constraint
      2. Projects That Use Managed Extensions
      3. Porting Unmanaged Code to the .NET Framework
        1. Constraints
    27. Unsupported Features
      1. Verifiable Code
      2. Managed Templates
        1. Example
      3. C++ RTTI versus Runtime Reflection
        1. Example
        2. Constraint
      4. Non-Public Inheritance
        1. Example
      5. const and volatile on Member Functions
        1. Example
    28. References
      1. Bibliography
  6. A. C++ Compiler Options
    1. Compiler Options
      1. Listed by Category
        1. Optimization
        2. Code Generation
        3. Output Files
        4. Debugging
        5. Preprocessor
        6. Language
        7. Linking
        8. Precompiled Header
        9. Miscellaneous
      2. Listed Alphabetically
      3. @ (Specify a Compiler Response File)
        1. Remarks
          1. To set this compiler option in the Visual Studio development environment
          2. To set this compiler option programmatically
      4. /HELP (Compiler Command-Line Help)
        1. To set this compiler option in the Visual Studio development environment
        2. To set this compiler option programmatically
      5. /AI (Specify Metadata Directories)
        1. Remarks
      6. /c (Compile Without Linking)
        1. To set this compiler option in the Visual Studio development environment
        2. To set this compiler option programmatically
        3. Example
      7. /clr (Common Language Runtime Compilation)
        1. Remarks
        2. Metadata and Unnamed Classes
        3. CLS Compliance
        4. /clr Restrictions
      8. /D (Preprocessor Definitions)
        1. Examples
      9. /E (Preprocess to stdout)
        1. Example
      10. /EH (Exception Handling Model)
      11. /EP (Preprocess to stdout Without #line Directives)
        1. Example
      12. /F (Set Stack Size)
        1. Remarks
      13. /FA, /Fa (Listing File)
        1. Example
      14. /Fd (Program Database File Name)
        1. Example
      15. /Fe (Name EXE File)
        1. Examples
      16. /FI (Name Forced Include File)
      17. /Fm (Name Mapfile)
      18. /Fo (Object File Name)
        1. Example
      19. /Fp (Name .pch File)
        1. Examples
      20. /FR, /Fr (Create .sbr File)
      21. /FU (Name Forced #using File)
        1. Remarks
      22. /Fx (Merge Injected Code)
      23. /G (Optimize for Processor) Options
      24. /GA (Optimize for Windows Application)
      25. /G (Optimize for Processor) Options
      26. /Gd, /Gr, /Gz (Calling Convention)
        1. __cdecl Specifics
        2. __fastcall Specifics
        3. __stdcall Specifics
      27. /Ge (Enable Stack Probes)
      28. /Gf, /GF (Eliminate Duplicate Strings)
      29. /GH (Enable _pexit Hook Function)
      30. /Gh (Enable _penter Hook Function)
      31. /GL (Whole Program Optimization)
      32. /Gm (Enable Minimal Rebuild)
      33. /GR (Enable Run-Time Type Information)
      34. /Gd, /Gr, /Gz (Calling Convention)
        1. __cdecl Specifics
        2. __fastcall Specifics
        3. __stdcall Specifics
      35. /GS (Buffer Security Check)
        1. Example
      36. /Gs (Control Stack Checking Calls)
        1. Remarks
      37. /GT (Support Fiber-Safe Thread-Local Storage)
      38. /GX (Enable Exception Handling)
      39. /Gy (Enable Function-Level Linking)
      40. /GZ (Enable Stack Frame Run-Time Error Checking)
      41. /Gd, /Gr, /Gz (Calling Convention)
        1. __cdecl Specifics
        2. __fastcall Specifics
        3. __stdcall Specifics
      42. /H (Restrict Length of External Names)
        1. Remarks
      43. /HELP (Compiler Command-Line Help)
        1. To set this compiler option in the Visual Studio development environment
        2. To set this compiler option programmatically
      44. /I (Additional Include Directories)
        1. Remarks
        2. Example
      45. /J (Default char Type Is unsigned)
      46. /MD, /ML, /MT, /LD (Use Run-Time Library)
      47. /MD, /ML, /MT, /LD (Use Run-Time Library)
      48. /noBool (Suppress C++ Boolean Keywords)
        1. To set this compiler option in the Visual Studio development environment
        2. To set this compiler option programmatically
      49. /nologo (Suppress Startup Banner)
      50. /O1, /O2 (Minimize Size, Maximize Speed)
      51. /Oa, /Ow (Assume No Aliasing, Assume Aliasing Across Function Calls)
        1. Rules for Using /Oa and /Ow
      52. /Ob (Inline Function Expansion)
      53. /Od (Disable (Debug))
      54. /Og (Global Optimizations)
      55. /Oi (Generate Intrinsic Functions)
      56. /Op (Improve Float Consistency)
      57. /Os, /Ot (Favor Small Code, Favor Fast Code)
      58. /Oa, /Ow (Assume No Aliasing, Assume Aliasing Across Function Calls)
        1. Rules for Using /Oa and /Ow
      59. /Ox (Full Optimization)
      60. /Oy (Frame-Pointer Omission)
      61. /QI0f (Enable Pentium 0x0f Fix)
      62. /QIfdiv (Enable Pentium FDIV Fix)
      63. /QIfist (Suppress _ftol)
      64. /P (Preprocess to a File)
        1. Example
      65. /RTC (Run-Time Error Checks)
      66. /showIncludes (List Include Files)
      67. /Tc, /Tp, /TC, /TP (Specify Source File Type)
        1. Remarks
        2. Examples
      68. /U, /u (Undefine Symbols)
        1. Remarks
      69. /V (Version Number)
        1. Remarks
      70. /vd (Disable Construction Displacements)
      71. /vmb, /vmg (Representation Method)
      72. /vmm, /vms, /vmv (General Purpose Representation)
      73. /Wn, /WX, /Wall, /wnn, /wdn, /wen, /won (Warning Level)
      74. /Wp64 (Detect 64-Bit Portability Issues)
      75. /X (Ignore Standard Include Paths)
        1. Example
      76. /Y- (Ignore Precompiled Header Options)
      77. /Yc (Create Precompiled Header File)
        1. Example
      78. /Yd (Place Debug Information in Object File)
        1. Examples
      79. /Yl (Inject PCH Reference for Debug Library)
        1. Remarks
      80. /Yu (Use Precompiled Header File)
        1. Examples
      81. /YX (Automatic Use of Precompiled Headers)
        1. Example
      82. /Z7, /Zd, /Zi, /ZI (Debug Information Format)
      83. /Za, /Ze (Disable Language Extensions)
      84. /Zc (Conformance)
      85. /Za, /Ze (Disable Language Extensions)
      86. /Zg (Generate Function Prototypes)
      87. /Z7, /Zd, /Zi, /ZI (Debug Information Format)
      88. /Zm (Specify Memory Allocation Limit)
        1. Remarks
      89. /Zp (Struct Member Alignment)
      90. /Zs (Syntax Check Only)
  7. B. Visual C++ Linker Options
    1. Linker Options
      1. @ (Specify a Linker Response File)
        1. Remarks
          1. To set this linker option in the Visual Studio development environment
          2. To set this linker option programmatically
      2. /ALIGN (Section Alignment)
        1. Remarks
      3. /ALLOWBIND (Prevent DLL Binding)
      4. /ASSEMBLYMODULE (Add a MSIL Module to the Assembly)
        1. Remarks
      5. /ASSEMBLYRESOURCE (Embed a Managed Resource)
        1. Remarks
      6. /BASE (Base Address)
      7. /DEBUG (Generate Debug Info)
      8. /DEF (Specify Module-Definition File)
        1. Remarks
      9. /DEFAULTLIB (Specify Default Library)
        1. Remarks
          1. To set this linker option in the Visual Studio development environment
      10. /DELAY (Delay Load Import Settings)
      11. /DELAYLOAD (Delay Load Import)
        1. Remarks
      12. /DLL (Build a DLL)
      13. /DRIVER (Windows NT Kernel Mode Driver)
      14. /ENTRY (Entry-Point Symbol)
        1. Remarks
      15. /EXETYPE (Executable File Type)
        1. Remarks
      16. /EXPORT (Exports a Function)
      17. /FIXED (Fixed Base Address)
      18. /FORCE (Force File Output)
      19. /HEAP (Set Heap Size)
      20. /IDLOUT (Name MIDL Output Files)
        1. Remarks
      21. /IGNOREIDL (Don’t Process Attributes into MIDL)
      22. /IMPLIB (Name Import Library)
        1. Remarks
      23. /INCLUDE (Force Symbol References)
        1. Remarks
      24. /INCREMENTAL (Link Incrementally)
      25. /LARGEADDRESSAWARE (Handle Large Addresses)
      26. /LIBPATH (Additional Libpath)
        1. Remarks
      27. /LTCG (Link-time Code Generation)
        1. Remarks
          1. To set this linker option in the Visual Studio development environment
      28. /MACHINE (Specify Target Platform)
      29. /MAP (Generate Mapfile)
        1. Remarks
      30. /MAPINFO (Include Information in Mapfile)
      31. /MERGE (Combine Sections)
      32. /MIDL (Specify MIDL Command Line Options)
        1. Remarks
      33. /NOASSEMBLY (Create a MSIL Module)
      34. /NODEFAULTLIB (Ignore Libraries)
        1. Remarks
      35. /NOENTRY (No Entry Point)
      36. /NOLOGO (Suppress Startup Banner)
        1. To set this linker option in the Visual Studio development environment
        2. To set this linker option programmatically
      37. /OPT (Optimizations)
      38. /ORDER (Put Functions in Order)
        1. Remarks
      39. /OUT (Output File Name)
        1. Remarks
      40. /PDB (Use Program Database)
        1. Remarks
      41. /PDBSTRIPPED (Strip Private Symbols)
        1. Remarks
      42. /RELEASE (Set the Checksum)
      43. /SECTION (Specify Section Attributes)
      44. /STACK (Stack Allocations)
      45. /STUB (MS-DOS Stub File Name)
        1. Remarks
      46. /SUBSYSTEM (Specify Subsystem)
        1. Remarks
      47. /SWAPRUN (Load Linker Output to Swap File)
      48. /TLBID (Specify Resource ID for TypeLib)
        1. Remarks
      49. /TLBOUT (Name .TLB File)
        1. Remarks
      50. /TSAWARE (Create Terminal Server Aware Application)
      51. /VERBOSE (Print Progress Messages)
      52. /VERSION (Version Information)
        1. Remarks
      53. /VXD (Create Virtual Device Driver)
      54. /WS (Aggressively Trim Process Memory)
    2. Compiler-Controlled LINK Options
    3. LINK Input Files
      1. .obj Files as Linker Input
      2. .lib Files as Linker Input
      3. .exp Files as Linker Input
      4. .pdb Files as Linker Input
      5. .res Files as Linker Input
      6. .exe Files as Linker Input
      7. .txt Files as Linker Input
      8. .ilk Files as Linker Input
    4. LINK Output
      1. Output Files
      2. Other Output
    5. Module-Definition (.def) Files
    6. Reserved Words
  8. Index
  9. About the Author
  10. Copyright