PDF Ebook C++ Programming Guide
The Sun WorkShop™ 6 C++ compiler, CC, described in this book (and the companion book, C++ User’s Guide) is available under the Solaris 2.6, Solaris 7, and Solaris 8 operating environments on the SPARC™ and IA platforms. Sun WorkShop 6 C++ compiler implements the language and libraries described in the C++ International Standard.
C++ was first described in The C++ Programming Language by Bjarne Stroustrup, and later more formally described in The Annotated C++ Reference Manual, by Margaret Ellis and Bjarne Stroustrup. An international standard for C++ is now available.
C++ is designed as a superset of the C programming language. While retaining efficient low-level programming, C++ adds:
- Stronger type checking
- Extensive data abstraction features
- Support for object-oriented programming
- Synchronous exception handling
- A large standard library
The support for object-oriented programming allows good design of modular and extensible interfaces among program modules. The standard library, including an extensible set of data types and algorithms, speeds the development of common applications.
Contents
Preface
1. Introduction
- 1.1 The C++ Language
- 1.1.1 Data Abstraction
1.1.2 Object-Oriented Features
1.1.3 Type Checking
1.1.4 Classes and Data Abstraction
1.1.5 Compatibility With C
2. Program Organization
- 2.1 Header Files
- 2.1.1 Language-Adaptable Header Files
2.1.2 Idempotent Header Files
2.1.3 Self-Contained Header Files
2.1.4 Unnecessary Header File Inclusion
2.2 Inline Function Definitions
2.2.1 Function Definitions Inline
2.2.2 Function Definitions Included
2.3 Template Definitions
- 2.3.1 Template Definitions Included
2.3.2 Template Definitions Separate
3. Pragmas
- 3.1 Pragma Forms
3.2 Pragma Reference
- 3.2.1 #pragma align
3.2.2 #pragma init
3.2.3 #pragma fini
3.2.4 #pragma ident
3.2.5 #pragma pack(n)
3.2.6 #pragma unknown_control_flow
3.2.7 #pragma weak
4. Templates
- 4.1 Function Templates
- 4.1.1 Function Template Declaration
4.1.2 Function Template Definition
4.1.3 Function Template Use
4.2 Class Templates
- 4.2.1 Class Template Declaration
4.2.2 Class Template Definition
4.2.3 Class Template Member Definitions
4.2.4 Class Template Use
4.3 Template Instantiation
- 4.3.1 Implicit Template Instantiation
4.3.2 Whole-Class Instantiation
4.3.3 Explicit Template Instantiation
4.4 Template Composition
4.5 Default Template Parameters
4.6 Template Specialization
- 4.6.1 Template Specialization Declaration
4.6.2 Template Specialization Definition
4.6.3 Template Specialization Use and Instantiation
4.6.4 Partial Specialization
4.7 Template Problem Areas
- 4.7.1 Nonlocal Name Resolution and Instantiation
4.7.2 Local Types as Template Arguments
4.7.3 Friend Declarations of Template Functions
4.7.4 Using Qualified Names Within Template Definitions
4.7.5 Nesting Template Declarations
5. Exception Handling
- 5.1 Understanding Exception Handling
5.2 Using Exception Handling Keywords
- 5.2.1 try
5.2.2 catch
5.2.3 throw
5.3 Implementing Exception Handlers
- 5.3.1 Synchronous Exception Handling
5.3.2 Asynchronous Exception Handling
5.4 Managing Flow of Control
- 5.4.1 Branching Into and Out of try Blocks and Handlers
5.4.2 Nesting of Exceptions
5.4.3 Specifying Exceptions to Be Thrown
5.5 Specifying Runtime Errors
5.6 Modifying the terminate() and unexpected() Functions
- 5.6.1 set_terminate()
5.6.2 set_unexpected()
5.7 Calling the uncaught_exception() Function
5.8 Matching Exceptions With Handlers
5.9 Checking Access Control in Exceptions
5.10 Enclosing Functions in try Blocks
5.11 Disabling Exceptions
5.12 Using Runtime Functions and Predefined Exceptions
5.13 Mixing Exceptions With Signals and Setjmp/Longjmp
5.14 Building Shared Libraries That Have Exceptions
6. Runtime Type Identification
- 6.1 Static and Dynamic Types
6.2 RTTI Options
6.3 typeid Operator
6.4 type_info Class
7. Cast Operations
- 7.1 New Cast Operations
7.2 const_cast
7.3 reinterpret_cast
7.4 static_cast
7.5 Dynamic Casts
- 7.5.1 Casting Up the Hierarchy
7.5.2 Casting to void*
7.5.3 Casting Down or Across the Hierarchy
8. Performance
- 8.1 Avoiding Temporary Objects
8.2 Using Inline Functions
8.3 Using Default Operators
8.4 Using Value Classes
- 8.4.1 Choosing to Pass Classes Directly
8.4.2 Passing Classes Directly on Various Processors
8.5 Cache Member Variables
9. Multithreaded Programs
- 9.1 Building Multithreaded Programs
- 9.1.1 Indicating Multithreaded Compilation
9.1.2 Using C++ Support Libraries With Threads and Signals
9.2 Using Exceptions in a Multithreaded Program
9.3 Sharing C++ Standard Library Objects Between Threads
Index Index
Download
PDF Ebook C++ Programming Guide
Posted in :