Next Index Doc Set Home


C++ User's Guide


Contents

Preface

1. The C++ Compiler

Operating Environments

Standards Conformance

Organization of the Compiler

C++ Tools

The C++ Language
Type Checking
Classes and Data Abstraction
Object-Oriented Features
Native Language Support
Compatibility With C

2. Using the C++ Compiler

Compiler Commands

Command Syntax

Compiling and Linking

Compatibility Between C++ 4.0.1 and C++ 4.1

Compatibility Between C++ 4.1 and C++ 4.2

Multiple File Extensions
Suffix Additions to the System Default Makefile
Suffix Additions to Your Makefile

Components

Pragmas
#pragma align
#pragma init and #pragma fini
#pragma ident
#pragma pack(n)
#pragma unknown_control_flow
#pragma weak

Options
ccfe and ld
-386
-486
-a
-Bbinding
-c
-cg[89|92]
+d
-Dname[=def]
-d[y|n]
-dalign
-dryrun
-E
+e[0|1]
-fast
-features=a
-flags
-fnonstd
-fns
-fprecision=p
-fround=r
-fsimple[=n]
-fstore
-ftrap=t
-G
-g
-g0
-H
-help
-hname
-i
-Ipathname
-inline=rlst
-instances=a
-keeptmp
-KPIC
-Kpic
-Ldir
-llib
-libmieee
-libmil
-library=l
-migration
-misalign
-mt
-native
-noex
-nofstore
-nolib
-nolibmil
-noqueue
-norunpath
-Olevel
-o filename
+p
-P
-p
-pentium
-pg
-PIC
-pic
-pta
-ptipath
-pto
-ptrdatabase-path
-ptv
-Qoption|-qoption prog opt
-qp
-Qproduce|-qproduce sourcetype
-R pathname
-readme
-S
-s
-sb
-sbfast
-staticlib=l
-temp=dir
-template=w
-time
-Uname
-unroll=n
-V
-v
-verbose=v
+w
-w
-xa
-xar
-xarch=a
-xcache=c
-xcg89
-xcg92
-xchip=c
-xF
-xildoff
-xildon
-xinline=rlst
-xlibmieee
-xlibmil
-xlibmopt
-xlic_lib=l
-xlicinfo
-Xm
-xM
-xM1
-xMerge
-xnolib
-xnolibmopt
-xOlevel
-xpg
-xprofile=p
-xregs=r
-xs
-xsafe=mem
-xsb
-xsbfast
-xspace
-xtarget=t
-xtime
-xunroll=n
-xwe
-Ztha
-ztext

3. Templates

Function Templates
Template Declaration
Template Definition
Template Use
Template Instantiation

Class Templates
Template Declaration
Template Definition
Template Use
Instantiation

Nested Template Use

Template Specialization, Standard Method
Declaration
Definition
Use and Instantiation

Template File Organization
Definitions-Included
Definitions-Separate

Potential Problem Areas
Non-Local Name Resolution and Instantiation
Local Types as Template Arguments
Friend Declarations of Template Functions

Template Compilation
Verbose Compilation
Template Database
Options File
Compile-Time Versus Link-Time Instantiation

Template Instance Linkage
Static Instance Linkage
Global Instance Linkage
External Instance Linkage

Template Definition Searching
Source File Location Conventions
Source File Extensions
Definitions Search Path
Options File Definition Entries

Template Instance Automatic Consistency
Options File Nocheck Field

Template Specialization, Deprecated Method
Specialized Template Definitions
Options File Specialization Entries

4. Exception Handling

Why Exception Handling?

Using Exception Handling
try
catch
throw
An Example

Implementing Exception Handlers
Synchronous Exception Handling
Asynchronous Exception Handling

Flow of Control
Branching Into and Out of try Blocks and Handlers
Nesting of Exceptions
Using throw in a Function Declaration

Runtime Errors

set_terminate() and set_unexpected() Functions
set_terminate()
set_unexpected()

Matching Exceptions With Handlers

Access Control in Exceptions

-noex Compiler Option

New Runtime Function and Predefined Exceptions

Default new-handler() Function

Building Shared Libraries With Exceptions

Using Exceptions in a Multithreaded Environment

5. Runtime Type Information

RTTI Options

typeid Operator

type_info Class

6. Cast Operations

Cast Operations Options

Const and Volatile Cast

Reinterpret Cast

Static Cast

Dynamic Cast

7. Moving From C to C++

Reserved and Predefined Words

Data Types

Creating Generic Header Files

Linking to C Functions

8. Fortran 77 Interface

Introduction

Sample Interface

Compatibility Issues
Function versus Subroutine
Data Type Compatibility
Arguments Passed by Reference or Value
Uppercase and Lowercase
Underscore in Names of Routines

C++ Name Encoding
Array Indexing and Order
File Descriptors and stdio
File Permissions

Fortran Calls C++
Arguments Passed by Reference
Character Strings Passed by Reference
Arguments Passed by Value
Function Return Values
Labeled Common
I/O Sharing
Alternate Returns

C++ Calls Fortran
Arguments Passed by Reference
Arguments Passed by Value
Function Return Values
Labeled Common
I/O Sharing
Alternate Returns

A. Migration Guide

B. Code Samples

C. Localization Support

Index




Next Index Doc Set Home