C++ Pocket Reference

Book description

C++ is a complex language with many subtle facets. This is especially true when it comes to object-oriented and template programming. The C++ Pocket Reference is a memory aid for C++ programmers, enabling them to quickly look up usage and syntax for unfamiliar and infrequently used aspects of the language. The book's small size makes it easy to carry about, ensuring that it will always be at-hand when needed. Programmers will also appreciate the book's brevity; as much information as possible has been crammed into its small pages.

In the C++ Pocket Reference, you will find:

  • Information on C++ types and type conversions
  • Syntax for C++ statements and preprocessor directives
  • Help declaring and defining classes, and managing inheritance
  • Information on declarations, storage classes, arrays, pointers, strings, and expressions
  • Refreshers on key concepts of C++ such as namespaces and scope
  • More!
C++ Pocket Reference is useful to Java and C programmers making the transition to C++, or who find themselves occasionally programming in C++. The three languages are often confusingly similar. This book enables programmers familiar with C or Java to quickly come up to speed on how a particular construct or concept is implemented in C++.

Together with its companion STL Pocket Reference, the C++ Pocket Reference forms one of the most concise, easily-carried, quick-references to the C++ language available.

Publisher resources

View/Submit Errata

Table of contents

  1. C++ Pocket Reference
  2. 1. C++ Pocket Reference
    1. Introduction
      1. Typographic Conventions
      2. Acknowledgments
      3. Compatibility with C
    2. Program Structure
      1. Startup
      2. Termination
      3. Header Files
      4. Source Files
      5. Preprocessor Directives
        1. #define
        2. #undef
        3. #ifdef, #ifndef, #else, #endif
        4. #if, #elif, #else, #endif
        5. #include
        6. #error
        7. #line
        8. #pragma
      6. Preprocessor Macros
    3. Fundamental Types
      1. bool
        1. Boolean values
        2. Boolean literals
      2. char and wchar_t
        1. Character values
        2. Character literals
      3. short, int, long
        1. Integer values
        2. Integer literals
      4. float, double, long double
        1. Floating-point values
        2. Floating-point literals
        3. void
    4. Compound Types
      1. Enumerations
      2. Arrays
        1. Multidimensional arrays
        2. Passing arrays to functions
        3. Initializer lists for arrays
      3. Strings
        1. String literals
      4. Pointers
        1. Pointer dereferencing
        2. Pointer arithmetic
        3. Void pointers
        4. Null pointers
        5. Function pointers
      5. Pointers to Members
      6. References
        1. Reference parameters
        2. References as l-values
      7. Class Types
    5. Type Conversions and Definitions
      1. Type Conversions
        1. Implicit conversions
        2. Preservation of values
        3. User-defined conversions
        4. Converting constructors
      2. Type Definitions
    6. Lexical Elements
      1. Comments
      2. Identifiers
      3. Reserved Words
      4. Literals
      5. Operators
        1. Associativity
        2. Precedence
        3. Scope resolution (::)
        4. Array subscript ([ ])
        5. Member selection (. and ->)
        6. Function call ( () )
        7. Value construction ( () )
        8. Postfix increment and decrement (++, −−)
        9. typeid
        10. C++ cast
        11. sizeof
        12. Prefix increment and decrement (++, −−)
        13. Bitwise NOT (˜)
        14. Logical NOT (!)
        15. Unary minus and plus (−, +)
        16. Address-of (&)
        17. Indirection (*)
        18. Allocate and deallocate
        19. C-style cast ( () )
        20. Pointer-to-member selection (.* and ->*)
        21. Arithmetic (*, /, %, +, −)
        22. Shift left and right (<<, >>)
        23. Relational (<, <=, >, >=, ==, !=)
        24. Bitwise AND, XOR, and OR (&, ^, |)
        25. Logical AND and OR (&&, ||)
        26. Conditional expression (?:)
        27. Simple and compound assignments (=, *=, /=, %=, +=, −=, <<=, >>=, &=, |=, ^=)
        28. Exception (throw)
        29. Sequence (,)
      6. Expressions
    7. Scope
      1. Local Scope
      2. Class Scope
      3. Namespace Scope
      4. File Scope
      5. Other Scopes
      6. Enclosing Scopes
    8. Declarations
      1. Declaring Variables
        1. Pointer variables
        2. Initialization
      2. Declaring Functions
        1. Function definitions
        2. Default arguments
        3. Inline functions
      3. Storage Classes
        1. static
        2. extern
        3. mutable
        4. auto
        5. register
      4. Qualifiers
        1. const
        2. volatile
    9. Statements
      1. Expression Statements
      2. Null Statements
      3. Compound Statements
      4. Iteration Statements
        1. while
        2. do
        3. for
      5. Selection Statements
        1. if
        2. switch
      6. Jump Statements
        1. break
        2. continue
        3. goto
        4. return
    10. Namespaces
      1. using Declarations
      2. using Directives
      3. Unnamed Namespaces
    11. Classes, Structs, and Unions
      1. Declaring Objects
      2. Accessing Members
      3. Declaring Data Members
        1. Static data members
        2. Constant data members
        3. Mutable data members
        4. Volatile data members
      4. Declaring Member Functions
        1. The this pointer
        2. Static member functions
        3. Constant member functions
        4. Volatile member functions
      5. Access Levels for Members
      6. Friends
      7. Constructors
        1. Default constructors
        2. Copy constructors
        3. Explicit constructors
        4. Member initializers
      8. Destructors
      9. Nested Declarations
      10. Forward Declarations
      11. Structs
      12. Unions
    12. Inheritance
      1. Constructors and Inheritance
        1. Order of construction
        2. Base class initializers
      2. Destructors and Inheritance
        1. Order of destruction
        2. Virtual destructors
      3. Virtual Member Functions
      4. Abstract Base Classes
      5. Access Levels for Inheritance
      6. Multiple Inheritance
      7. Virtual Base Classes
    13. Templates
      1. Template Classes
        1. Instantiation of template classes
        2. Member functions in template classes
        3. Explicit specialization of template classes
        4. Nontype parameters in template classes
        5. Default arguments for template classes
      2. Template Functions
        1. Instantiation of template functions
        2. Arguments to template functions
        3. Explicit specialization of template functions
        4. Nontype parameters in template functions
    14. Overloading
      1. Overloading Functions
      2. Overloading Operators
        1. Assignment operator
        2. Memory management operators
    15. Memory Management
      1. Memory Allocation
        1. new
        2. new[ ]
        3. Placement new
        4. Failed allocation
      2. Memory Reclamation
        1. delete
        2. delete[ ]
    16. Casts and Runtime Type Information
      1. C-Style Casts
      2. Casts in C++
        1. dynamic_cast
        2. static_cast
        3. const_cast
        4. reinterpret_cast
      3. Runtime Type Information
        1. typeid
        2. type_info
    17. Exception Handling
      1. try
      2. throw
      3. catch
      4. Exception Specifications
    18. The C++ Standard Library
      1. The std Namespace
      2. C Standard Library Support
      3. C++ Standard Header Files
      4. I/O Streams
        1. cin
        2. cout
        3. cerr
        4. clog
  3. Index
  4. About the Author
  5. Copyright

Product information

  • Title: C++ Pocket Reference
  • Author(s): Kyle Loudon
  • Release date: August 2008
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596004965