Exceptional C++ - Revised Index

Home Blog Talks Books & Articles Training & Consulting

Prev
Up

On the
blog
RSS feed November 4: Other Concurrency Sessions at PDC
November 3
: PDC'09: Tutorial & Panel
October 26: Hoare on Testing
October 23
: Deprecating export Considered for ISO C++0x

(See also the Exceptional C++ Errata List.)

This updated index applies to all printings of Exceptional C++, and is the index included in the book from the fourth printing onward (English edition).

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

#define,
see: macros

#include,
see: Pimpl idiom

#pragma, 113

A

AAssert, 192

Abrahams, Dave, 25, 38, 59

abstract class,
see: class, abstract

abstraction, 97-98

accumulate, 136-137

example use, 134

Adler, Darin, 136

aggregation,
see: containment

AInvariant, 193

AINVARIANT_GUARD, 193-194

Alexandrescu, Andrei, xiii

algorithms,

auto_ptr and, 156-157

standard library,
see: algorithms by name (e.g., copy)

alignment, 113, 117-118

allocation,
see: memory and resource management

allocator, 59

ambiguity,
see: function overloading; name lookup

Annotated C++ Reference Manual (ARM),
alluded to, 187

Array, 193-194

arrays,

misuse of, 148

polymorphism and, 147

prefer vector or deque instead, 147-148

assert, 195

example use, 30, 192-194

assign, 14-15

assignment

avoiding by constructing in place, 53

copy assignment, 9-17

not a template, 11-13

copy construction interaction, 165-172

iterator ranges and, 14-15

self-assignment,

exception safety and, 32, 37, 47, 160, 169-171

need to check for, 32, 37, 159-161, 169-171

swap and, 47, 170-171

templated, 11-17

to self,
see: assignment, self-assignment

Austern, Matt, 25, 59

auto, 174

auto_ptr, 150-158
see also: sources; sinks

algorithms and, 156-157

const auto_ptr idiom, 158

containers and, 156-157

example use, 66

members, 153-154, 157-158

ownership, 154-155, 157

passing, 154-157

Pimpl idiom and, 153-154

returning can improve exception safety, 66-67

usefulness of, 151-153

wrapping pointer data members, 153-154, 157-158

B

back_inserter,
example use, 1-2

bad_alloc, 145-150, 197

bad_cast, 186

base class,
see: class, base

basic_ostream, 101-102

example use, 9

basic_string, 5
see also: string(s)

c_str vs. implicit conversion to char*, 162-163

BasicProtocol, 80-82

bool, 187-190

Bridge pattern,
see: design patterns, Bridge

C

C,
object-oriented programming in, 124-125

C With Classes, 181-182

C++ Report, 25

caching precomputed values, 18

calloc, 143

relationship with new, 143

Cargill, Tom, 25-26, 30, 32

case-insensitive comparison
see: string(s), case-insensitive comparison

casts,
see also: const_cast, dynamic_cast, reinterpret_cast, static_cast

C vs. C++ casts, 183

void* and, 184

cat, abuse of, 38

catch,
see: exception safety

Chang, Juana,
PeerDirect Dessert Society and, v

char_traits, 5
see also: string(s), comparison

Cheers, Mark, v

ci_char_traits, 4-9

ci_string, 4-9

cin,

example use, 1-2

Clamage, Steve, xiii

class(es),
see also: name hiding

abstract, 90

base, 77

design considerations and guidelines, 69-98

empty base,
see also: empty base class optimization

interface of,
see: Interface Principle

member vs. nonmember functions, 125
see also: Interface Principle

namespaces and, 136-140

one class, one responsibility,
see: cohesion

Pimpl idiom and,
see: Pimpl idiom

private members, hiding,
see: Pimpl idiom

virtual base,
see: inheritance, virtual

code paths,
see: control flow

code reuse,
see: reuse

cohesion, 67, 85, 94
see also: coupling

Colvin, Greg, 25, 59, 150

communications protocol example, 80-82

comp.lang.c++.moderated newsgroup, ix-xii, 25

comparison, case-insensitive
see: string(s), case-insensitive comparison

compilation dependencies, 87
see also: Pimpl idiom

compilation firewalls,
see: Pimpl idiom

complex, 79

example use, 76

Complex, 69-75

composition,
see: containment

conditions,

short-circuit evaluation and,
see: control flow

const, 175-181
see also: mutable

auto_ptr idiom, 158

cast,
see: const_cast

correctness, 175-181

iterator,
see: iterator(s), const_iterator

member functions, 177-181

return value, 72-73

const correctness,
see: const, correctness

const_cast, 176-187

undefined behavior and, 179

to work around absence of mutable, 178

to work around const-incorrect third-party interfaces, 181-182

const_iterator,
see: iterator(s), const_iterator

construct, 41-42

used, 46, 48, 51

constructor,
see also: initialization

conversion by, 19, 70
see also: conversions, implicit

copy constructor, 9-17, 53-54

copy assignment interaction, 165-172

elision by compiler, 190-191

not a template, 11-13

default, 15, 27-28, 53-54

exceptions and, 28, 58, 62

explicit, 19, 70, 162-163

failure of, 28

initialization list, 196

iterator ranges and, 14-15

templated, 11-17

containers,
see also: list; vector; etc.

auto_ptr and, 16-157

destructible, 38, 59

homogeneous, 13

containment,

generic, 94-95

inheritance vs., 82, 89-96, 107-108

control flow, 60-68

exceptions and,
see: exceptions, control flow and

short-circuit evaluation and, 61-62

conversions,

implicit, 19, 70, 162-163, 189

exceptions and, 62

explicit, 19, 70

Coplien, Jim, 109

copy,

example use, 1-2, 11-12, 30, 193

exception safety and, 15-17, 197

copy assignment,
see: assignment, copy assignment

copy construction,
see: constructor, copy constructor

coupling, 88, 92
see also: cohesion; Pimpl idiom

D

declaration,

definition vs., 85

forward, 85, 100-102

decoupling,
see: coupling; Pimpl idiom

default constructor
see: constructor, default

deallocate, 59

default parameters, 70, 78

example use, 75

#define,
see: macros

definition vs. declaration,
see: declaration, definition vs.

delegation,
see: containment

delete, 27, 29, 144-150

array delete[], 29, 57-58

example use, 31

placement, 148-149

relationship with free, 142-143

should never throw, 29, 57-58

virtual destructor and,
see: virtual destructor

dependencies,
see: coupling; Pimpl idiom; Interface Principle

deque,

arrays vs., 147-148

exception guarantees and, 59-60

design patterns, 84-85

Bridge pattern, 84

Pimpl idiom vs., 84

Singleton, alluded to, 115

Strategy, 87

Template Method pattern, 84

public virtual functions vs., 84

destroy, 41-42, 55-56

used, 49, 52

destroy-and-reconstruct idiom, 163-172

exception safety and, 168

destructor, 29

operator delete and, 147

should never throw, 28-29, 55-58

virtual,
see: virtual destructor

Dewhurst, Steve, xiii

dynamic type,
see: type, dynamic

dynamic_cast, 181-187

inheritance and, 185-186

dynamically allocated memory,
see: memory and resource management

E

Effective C++,
see: not this book
see also: this book

Einstein, Albert, 107

Employee, 17-23

empty base class optimization, 91

encapsulation, 97-98

end(), dereferencing,
see: iterators, dereferencing end()

enum, 188

EvaluateSalaryAndReturnName, 60-68

evaluation order of function arguments, 197

exception handling, 97-98

exception neutral, 26,

exception safety, 25-68

affects class design, 17, 26, 35

assignment and, 15-17, 31

casting and, 186

destroy-and-reconstruct idiom and, 164, 168

dynamically allocated resources can improve, 66-67

encapsulation and, 40

guarantees, 26, 38

basic guarantee, 38, 59

nothrow guarantee, 16, 38, 59

destructors and, 29, 55-58

swap and, 44, 47, 59

strong guarantee, 16, 38, 59

iterator invalidation and, 38

multiple side effects and, 64-68

not always necessary, 67

performance overhead and, 67

history of, 25

object lifetime and, 163-165

overhead and, 60

placement new and delete and, 148-150

return by value and, 34-37, 66-68

side effects and, 34-37, 64-68

standard library and, 26, 59-60

swap and, 16, 43-44, 59, 170-171

throw() specification, 53

try/catch and, 39, 50

exception specifications, 54

Exceptional C++,
see: this book
see also: not this book

exceptions,

control flow and, 61-63

multiple, 56

execution flow,
see: control flow

explicit, 19

extractor, using, 2

F

false,
see: bool

Fast Pimpl idiom, 111-118
see also: Pimpl idiom

FastArenaObject, 115-118

find, 23

find_if, 23

FindAddr, 17-23

firewall, compilation,
see: Pimpl idiom

FixedAllocator, 115-118

fixed_vector, 9-17

flow of execution,
see: control flow

Ford Escort, 151

forward declaration,
see: declaration, forward

forwarding function, 190-192

free,

relationship with delete, 142-143

free store, 142

French,

gratuitous use of, 90, 102

friend, friendship, 88, 123

Fulcher, Margot,

Superwoman and, v

function arguments,

evaluation order of, 197-199

function overloading, 120
see also: name lookup

functors,

alluded to, 23

G

garbage collection,

alluded to, 98

Generic Liskov Substitution Principle, 8

generic containment/delegation, 94-95

generic programming, 1-17, 88, 97-98
see also: standard library; templates

GenericTableAlgorithm, 83-88

GenericTableAlgorithmImpl, 86

Gibbons, Bill, 150

global data, 142

GLSP,
see: Generic Liskov Substitution Principle

GotW,
see: Guru of the Week

GTAClient, 86

Guru of the Week (GotW), ix-xii, 25, 150, 158, 201-202

H

handle/body idiom,
see: Pimpl idiom

HAS-A, 107
see: containment

header files,
see: Pimpl idiom

heap, 142

Henney, Kevlin, 10

hiding names,
see: name hiding

Horstmann, Cay, xiii

Hyslop, Jim, xiii, 161

I

implicit conversions
see: conversions, implicit

#include,
see: Pimpl idiom

increment operator
see: operators, ++

infinite loop,
see: loop, infinite

inheritance, 97-98

deep hierarchies of, 81

dynamic_cast and, 185-186

empty base class optimization, 91

from char_traits, 7-8

IS-A,
see: Liskov Substitution Principle

IS-ALMOST-A, 95-96

Liskov Substitution Principle (LSP),
see: Liskov Substitution Principle

not for reuse, 81-82

overuse of, 88-96, 107-108

polymorphism and, 7-8

private, 44, 52-53

protected, 92

public, 80-82, 95-96
see also: Liskov Substitution Principle

static members and, 8

virtual, 91

WORKS-LIKE-A,
see: Liskov Substitution Principle

initialization,

copy initialization, 173-174

default initialization, 173-174

direct initialization, 173-174

of base classes, 196

of global data, 192-199

list,
see: constructor, initialization list

resource acquisition is,
see: resource acquisition is initialization

static and, 192-199

inline, 20, 191-192

Interface Principle, 122-133

dependencies and, 131-133

iosfwd, 101

iostream, 100-102

IS-A,
see: Liskov Substitution Principle

IS-IMPLEMENTABLE-IN-TERMS-OF, 94-95

IS-IMPLEMENTED-IN-TERMS-OF, 81-82, 89-96

private inheritance vs. containment, 44, 52-53, 89-96

istream_iterator, 1-2

iterator(s), 1-3

algorithms and, 2

assignment and, 14-15

common mistakes, 1-3

const_iterator, 178

example use, 22

construction and, 14-15

dereferencing end(), 2

exceptions and, 59

lifetime,
see: iterator(s), validity

modifying,

why --end() may be illegal, 2-3

ranges, 2-3

validity, 2-3

exception safety and, 38

J

Jagger, Jon, 10

Jones, Morgan,

rituals of EMACS worship and, v

K

Karabegovic, Justin, v

Kehoe, Brendan, xiii

Koenig, Andrew, 120, 162

Koenig name lookup, 119-121, 125-130

L

Lafferty, Debbie, xiii

Lajoie, Josée, xi

Lang, Marina, xiii

layering,
see: containment

less, 161

lifetime,

of iterators,
see: iterator(s), validity

of objects,
see: object(s), lifetime

of references, 21

Lippman, Stan, xi

Liskov, Barbara, 8

Liskov Substitution Principle, 8, 81-82, 95-96, 107-108

IS-ALMOST-A vs., 95-96

protected inheritance and, 92

list, 36

example use, 17-18, 22, 99, 103

Loi, Duk, v

Long, Ian, v

loop, infinite,
see: infinite loop

LSP,
see: Liskov Substitution Principle

Lukov, Violetta, v

M

Machiavelli, Niccolo,

alluded to, 159-161

macros,

evils of, 74, 188

main,

does not return void, 76-77

return and, 77

standard signatures, 77

malloc, 111, 114, 117

relationship with new, 142-143

managing dependencies,
see: coupling, Pimpl idiom

Mancl, Dennis, xiii

map,

pointers and, 161

max_align, 118

member functions,

const, 177-181

nonmember vs., 125
see also: Interface Principle

templated,
see: templates, member functions

memory and resource management, 27, 144-150

avoiding leaks, 27

dynamically allocated resources can improve exception safety, 66-67

encapsulating for better exception safety, 40-52

fixed-size allocators, 114

Meyers, Scott, ix, xi, xiii, 25, 29, 147, 171

modules,

alluded to, 97-98

Moo, Barbara, 162

multiparadigm language, 97-98

Murphy, Edward A., Jr.

alluded to, 159-160

mutable, 178-182, 184

workaround using const_cast, 178

Myers Example, 128-130

Myers, Nathan, 8, 91, 128

MyList, 89-96

MySet, MySet1, MySet2, 89-96

MySet3, 94-95

N

name hiding, 77, 133-140

base classes and, 134-135

explicit scope resolution and, 135

name lookup, 119-140

namespaces, 119-140
see also: name hiding; using

class design and, 136-140

indirect interactions between, 121, 130

new, 27-28, 111, 114, 117, 144-150

array new[], 27, 57-58

default constructor and, 41

example use, 27-28, 30

placement, 42

destroy-and-reconstruct idiom, 163-172

exception from, 148-150

relationship with malloc, 142-143

new-style casts,
see: casts, C vs. C++ casts

NewCopy, 30-33

Nguyen, Kim,

tunnels and, v

not this book,
see: Effective C++

O

object(s),

destructible, 38

identity, 159-161

lifetime, 163-172

exception safety and, 163-164, 168

slicing, 164, 167-170

temporary
see: temporary objects

object-oriented programming, 97-98

C and, 124-125

not just about inheritance,
see: inheritance, overuse of

without classes, 124-125

Occam, William of, 87

Occam's Razor, 87

one class, one responsibility,
see: cohesion

opaque pointer,
see: Pimpl idiom

operator delete, 27-28, 59, 142-150

example use, 41

virtual destructor and, 147

operator new, 27-28, 142-150

example use, 41

operators,

+, 9, 71-73

example use, 133-134, 175

++, 18-20, 73-74

+=, 71

=, 72, 165-172

&, 160, 163, 165

!=, 160

(), 72, 87

[], 72

->, 72

<<, 9, 73, 130-133

example use, 100

exceptions and, 62, 64

virtual Print() and, 130-133

>>, 9

example use, 1-2

assignment,
see: assignment

chaining, 72-73

conversion,
see: conversions

delete,
see: delete; operator delete

member vs. nonmember, 72-73

new,
see: new; operator new

implementing related, 71-72

preincrement,
see: operators, ++

postincrement,
see: operators, ++

ostream, 100-102

example use, 100, 130

Overload magazine, 10

overload resolution, 187-190
see also: function overloading; name lookup

overriding vs. overloading, 77-79
see also: virtual functions

P

Palmer, Larry,

Against All Odds and, v

pass by reference, 190-191

pass by value,
see also: temporary objects

const and, 176

patterns,
see: design patterns

PeerDirect, v, xi-xiii, 103, 110, 201

Pimpl idiom, 84-85, 99-118
see also: Fast Pimpl idiom

auto_ptr and, 153-154

back pointers and, 111

Bridge pattern vs., 84

overhead, 111-118

performance, 111-118

virtual functions and, 110

pivot,

during sorting, 157

placement delete,
see: delete, placement

placement new,
see: new, placement

pointer,

opaque,
see: Pimpl idiom

Polygon, 175-181

polymorphism, 97-98
see also: Liskov Substitution Principle

arrays and, 147

exception specifications and, 54

virtual destructor and, 8, 77

virtual functions and, 8, 82

Pop Goes the Weasel,

reference to, 34

postincrement operator
see: operators, ++

#pragma, 113

precomputing values, 18, 23

pregnant,

a little bit, 96

preincrement operator
see: operators, ++

private inheritance,
see: inheritance, private

programming, generic
see: generic programming

protected,

members, 53, 82

public inheritance,
see: inheritance, public

Q

queue, 94

R

realloc, 143

relationship with new, 143

recomputing values,
see: precomputing values

Rectangle example, 95

references,
see also: temporary objects, pass-by-value and

validity, 21

reinterpret_cast, 181-187

example use, 112, 117-118

reserved names, 74

resource acquisition is initialization, 46, 168

resource management,
see: memory and resource management

return,

by reference, 20-21

by value, 20-21, 34-37

exception safety and, 66-68

main and, 77

reuse,

analyzing reusability, 53-54

benefits of, 22-23

inheritance not for, 81-82, 96

standard library and, 22-23, 70

Rumsby, Steve, 150

S

scope resolution, 135

self-assignment,
see: assignment, self-assignment

Shakespeare, William,

gratuitous quotes from, 163

SharedMemory, 145-150

Shelley, Doug,

boom in global coffee industry and, v

short-circuit evaluation,
see: control flow

sink functions, 154-157

slicing,
see: object(s), slicing

smart pointers,
see: auto_ptr

sort, 157

alluded to, 23

source functions, 154-157

Square example, 95

Stack, 26-54

copy constructor, 30-31, 46, 51

copy assignment operator, 30-32, 47-48, 51

Count, 33, 48, 51

default constructor, 27-28, 45-46, 51

destructor, 29

eliminated, 46

NewCopy and, 30-31

Pop, 34-37, 49, 52

division of responsibilities with Top, 36-37

Push, 33-34, 48-49, 51

requirements on contained type, 39, 53-54

Top, 36-37, 49, 51

stack, 142

stack, 36, 94

StackImpl, 40-44

Swap, 40, 43-44

used, 45-54

standard library,

exception safety and,
see: exception safety, standard library and

reusing code from, 22-23

static,

data, 142

operators new and delete should be declared, 146

return by reference and, 21

static type,
see: type, static

static_cast, 181-187

example use, 41, 192, 195

Strategy pattern,
see: design patterns, Strategy

streams,
see also: operators, >>; ostream

exception safety and, 64-65, 68

strcmp,
see: string, comparison

string,
see: basic_string; string(s)

string(s),

case-insensitive comparison, 4-9

comparison, 4-9

done in object or function, 6-7

c_str vs. implicit conversion to char*, 162-163

Stroustrup, Bjarne, xi, xiii, 162, 181-182

Sumner, Jeff, 103

dazzling code magery and, v

swap, 42, 59
see also: exception-safety, swap and

elegant copy assignment and, 47-48

T

template(s), 97-98
see also: generic programming

assignment operator, 11-13

constructor, 11-13

member functions, 9-17
see also: assignment, templated; constructor, templated

requirements on template parameter types, 39

Template Method pattern,
see: design patterns, Template Method

temporary objects, 17-23, 71

elision by compiler, 190-191

exceptions and, 62-63

modifying, 2-3

of builtin type, 2-3

pass by value and, 18, 71

recomputation and, 18

return-by-value and, 20-21

terminate, 28

this != other test, 159-161
see also: assignment, self-assignment

this book,
see: Exceptional C++

throw,
see: exception safety

toupper,

example use, 5-6

traits, 4-9

true,
see: bool

try,
see: exception safety

type,

dynamic, 79

static, 79

typedef, 187-188

typeid,

example use, 192-194

U

underscores,
see: reserved names

USES-A,
see: containment; HAS-A

using declarations and directives,

example use, 75, 89

forwarding function vs., 92

private and, 78

to avoid name hiding, 135

V

vector,

arrays vs., 147-148

example use, 1-2, 175

exception guarantees and, 59-60

iterator,

can be T*, 2-3

invalidation by insert(), 3

is random-access, 3

virtual base class,
see: inheritance, virtual

virtual destructor, 7-8, 77, 82

example use, 80, 83

operator delete and, 147

slicing and, 167

virtual functions, 7-8, 53, 75-79, 90

avoid public, 84

default parameters and, 78

exception specifications and, 54

Pimpl idiom and, 110

virtual inheritance,
see: inheritance, virtual

void,

main and,
see: main, does not return void

void*,

casts and, 184

W

wchar_t,

alluded to, 187

West, Declan, v

Wilson, Eric,

"in the beginning" and, v

Wizard of Oz, The,

reference to, 194

WORKS-LIKE-A,
see: Liskov Substitution Principle

Copyright © 2009 Herb Sutter