Effective C++

Effective C++
作 者: Scott Meyers
出版社: 中国电力出版社
丛编项: 原版风暴·深入C++系列
版权说明: 本书为公共版权或经版权方授权,请支持正版图书
标 签: C++
ISBN 出版时间 包装 开本 页数 字数
未知 暂无 暂无 未知 0 暂无

作者简介

  ScottMeyersScottMeyers:世界顶级的C++软件开发技术权威之一。他是两本畅销书EffectiveC++和MoreEffectiveC++的作者,以前曾经是C++Report的专栏作家。他经常为C/C++UsersJournal和Dr.Dobb'sJournal撰稿,也为全球范围内的客户做咨询活动。他也是AdvisoryBoardsforNumeriXLLC和InfoCruiser公司的成员。他拥有BrownUniversity的计算机科学博士学位。>>更多作品

内容简介

本书第一版曾创下销售100000本的辉煌业绩,并被翻译成四种语言,其原因不言自明。Scott Meyers的C++实用方法描述了编程专家所采用的规则,即他们几乎总是在做或总是在避免的事。遵循这些规则可以产生整洁、正确和高效的代码。本书的50个条款总结了编写更好的C++程序的方法,并配有特定的例子。在这一新版本中,Meyers重写了每个条款。这使得本书格外紧密地结合了C++国际标准、当前编译器技术以及对C++实际应用的最新洞察。本书将继续成为所有C++开发人员的必备读物。

图书目录

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