| ISBN | 出版时间 | 包装 | 开本 | 页数 | 字数 |
|---|---|---|---|---|---|
| 未知 | 暂无 | 暂无 | 未知 | 0 | 暂无 |
Preface
Acknowledgements
Introduction
Shifting
From
C
to
C++
Items
1:Prefer
const
and
inline
to
#define
Items
2:Prefer
iostream
to
stdio.h
Items
3:Prefer
new
and
delete
to
malloc
and
free
Items
4:Prefer
C++-style
comments
Memory
Management
Items
5:Use
the
same
form
in
corresponding
uses
of
new
and
delete
Items
6:Use
delete
on
pointer
members
in
destructors
Items
7:Be
prepared
for
out-of-memory
conditions
Items
8:Adhere
to
convention
when
writing
operator
new
and
operator
delete
Items
9:Avoid
hiding
the
"normal"
form
of
new
Items
10:Write
operator
delete
if
you
write
operator
new
Constructors,
Destructors,
and
Assignment
Operators
Items
11:Declare
a
copy
constructor
and
an
assignment
operator
for
classes
with
dynamically
allocated
memory
Items
12:Prefer
initialization
to
assignment
in
constructors
Items
13:List
members
in
an
initialization
list
in
the
order
in
which
they
are
declared
Items
14:Make
destructors
virtual
in
base
classes
Items
15:Have
operator
return
a
reference
to
*this
Items
16:Assign
to
all
data
members
in
operator
Items
17:Check
for
assignment
to
self
in
operator
Classes
and
Functions:
Design
and
Declaration
Items
18:Strive
for
class
interfaces
that
are
complete
and
minimal
Items
19:Differentiate
among
member
functions,
non-member
functions,
and
friend
functions
Items
20:Avoid
data
members
in
the
public
interface
Items
21:Use
const
whenever
possible
Items
22:Prefer
pass-by-reference
to
pass-by-value
Items
23:Don't
try
to
return
a
reference
when
you
must
return
an
object
Items
24:Choose
carefully
between
function
overloading
and
parameter
defaulting
Items
25:Avoid
overloading
on
a
pointer
and
a
numerical
type
Items
26:Guard
against
potential
ambiguity
Items
27:Explicitly
disallow
use
of
implicitly
generated
member
functions
you
don't
want
Items
28:Partition
the
global
namespace
Classes
and
Functions:
Implementation
Items
29:Avoid
returning
"handles"
to
internal
data
Items
30:Avoid
member
functions
that
return
non-const
pointers
or
references
to
members
less
accessible
than
themselves
Items
31:Never
return
a
reference
to
a
local
object
or
to
a
dereferenced
pointer
initialized
by
new
within
the
function
Items
32:Postpone
variable
definitions
as
long
as
possible
Items
33:Use
inlining
judiciously
Items
34:Minimize
compilation
dependencies
between
files
Inheritance
and
Object-Oriented
Design
Items
35:Make
sure
public
inheritance
models
"isa."
Items
36:Differentiate
between
inheritance
of
interface
and
inheritance
of
implementation
Items
37:Never
redefine
an
inherited
nonvirtual
function
Items
38:Never
redefine
an
inherited
default
parameter
value
Items
39:Avoid
casts
down
the
inheritance
hierarchy
Items
40:Model
"has-a"
or
"is-implemented-in-terms-of"
through
layering
Items
41:Differentiate
between
inheritance
and
templates
Items
42:Use
private
inheritance
judiciously
Items
43:Use
multiple
inheritance
judiciously
Items
44:Say
what
you
mean;
understand
what
you're
saying
Miscellany
Items
45:Know
what
functions
C++
silently
writes
and
calls
Items
46:Prefer
compile-time
and
link-time
errors
to
runtime
errors
Items
47:Ensure
that
non-local
static
objects
are
initialized
before
they're
used
Items
48:Pay
attention
to
compiler
warnings
Items
49:Familiarize
yourself
with
the
standard
library
Items
50:Improve
your
understanding
of
C++
Afterword
Index