Introduction

1、Learning the fundamentals of a programming language is one thing; learning how to design and implement effective programs in that language is something else entirely.

想起<重构>里面说的一句话,写出计算机能理解的代码很容易,但是写好人能理解的代码不容易

2、A declaration tells compilers about the name and type of something, but it omits certain details.

3、Initialization is the process of giving an object its first value.

4、Constructors declared explicit are usually preferable to non-explicit ones, because they prevent compilers from performing unexpected (often unintended) type conversions. Unless I have a good reason for allowing a constructor to be used for implicit type conversions, I declare it explicit.

explicit 关键字限制不能进行隐式转换

5、The copy constructor is used to initialize an object with a different object of the same type, and the copy assignment operator is used to copy the value from one object to another of the same type

 class Widget {
public:
Widget(); // default constructor
Widget(const Widget& rhs); // copy constructor
Widget& operator=(const Widget& rhs); // copy assignment operator
...
};
Widget w1; // invoke default constructor
Widget w2(w1); // invoke copy constructor
10 w1 = w2; // invoke copy assignment operator</span>
Widget w3 = w2; // invoke copy constructor!</span>

pass by value 的时候使用的是copy constructor

6、undefined behavior:编译器不确定行为,如数组越界访问,dereference一个空指针等

7、When I use the term "interface," I'm generally talking about a function's signature, about the accessible elements of a class (e.g., a class's "public interface," "protected interface," or "private interface"), or about the expressions that must be valid for a template's type parameter (see Item 41).

8、A client is someone or something that uses the code (typically the interfaces) you write.

9、Two of my favorite parameter names, for example, are lhs and rhs. They stand for "left-hand side" and "right-hand side," respectively.

10、I often name pointers following the rule that a pointer to an object of type T is called pt. I use a similar convention for references: rw might be a reference to a Widget and ra a reference to an Airplane. I occasionally use the name mf when I'm talking about member functions.

11、As a language, C++ has no notion of threads — no notion of concurrency of any kind, in fact.

12、TR1 ("Technical Report 1") is a specification for new functionality being added to C++'s standard library.This functionality takes the form of new class and function templates for things like hash tables, reference-counting smart pointers, regular expressions, and more. All TR1 components are in the namespace tr1 that's nested inside the namespace std.

13、Boost is an organization and a web site (http://boost.org) offering portable, peer-reviewed, open source C++ libraries. Most TR1 functionality is based on work done at Boost, and until compiler vendors include TR1 in their C++ library distributions, the Boost web site is likely to remain the first stop for developers looking for TR1 implementations. Boost offers more than is available in TR1, however, so it's worth knowing about in any case.

<Effective C++>读书摘要--Introduction的更多相关文章

  1. <Effective C++>读书摘要--Designs and Declarations<一>

    <Item 18> Make interfaces easy to use correctly and hard to use incorrectly 1.That being the c ...

  2. <Effective C++>读书摘要--Inheritance and Object-Oriented Design<一>

    1.Furthermore, I explain what the different features in C++ really mean — what you are really expres ...

  3. <Effective C++>读书摘要--Implementations<二>

    <Item29> Strive for exception-safe code. 1.如下面的代码 class PrettyMenu { public: ... void changeBa ...

  4. <Effective C++>读书摘要--Implementations<一>

    1.For the most part, coming up with appropriate definitions for your classes (and class templates) a ...

  5. <Effective C++>读书摘要--Accustoming Youself to C++

    <Item 1>View C++ as a federation of languages. 1.把C++看成4种子语言组成,即C.Object-Oriented C++.Template ...

  6. <Effective C++>读书摘要--Templates and Generic Programming<一>

    1.The initial motivation for C++ templates was straightforward: to make it possible to create type-s ...

  7. <Effective C++>读书摘要--Inheritance and Object-Oriented Design<二>

    <Item 36> Never redefine an inherited non-virtual function 1.如下代码通过不同指针调用同一个对象的同一个函数会产生不同的行为Th ...

  8. <Effective C++>读书摘要--Designs and Declarations<三>

    <Item 22> Declare data members private 1.使数据成员private,保持了语法的一致性,client不会为访问一个数据成员是否需要使用括号进行函数调 ...

  9. <Effective C++>读书摘要--Designs and Declarations<二>

    <Item 20> Prefer pass-by-reference-to-const to pass-by-value 1.By default, C++ passes objects ...

随机推荐

  1. 【淘宝客】批量提取QQ号

    1:打开QQ群官方,网址:http://qun.qq.com/ 2.点击导航栏:群管理 3.点击成员管理,选择需要提取QQ号的群 4.全选复制群成员 5.打开网址:http://tool.oschin ...

  2. Ruby中类的进阶(继承,private, public, protect)

    类中的public,protect,private public method class Point def test end end 这样定义的test方法就是一个public方法可以在类内外使用 ...

  3. SpaceVim 语言模块 dart

    原文连接: https://spacevim.org/cn/layers/lang/dart/ 模块简介 功能特性 依赖安装及启用模块 启用模块 语法检查及代码格式化 安装 dart-repl 快捷键 ...

  4. Git中分支merge和rebase的适用场景及区别

    Git merge是用来合并两个分支的. git merge b      # 将b分支合并到当前分支 同样 git rebase b,也是把 b分支合并到当前分支 原理 如下: 假设你现在基于远程分 ...

  5. 老曹眼中的Linux基础

    Linux 几乎无处不在,不论是服务器构建,还是客户端开发,对操作系统的基本理解和基础技能的掌握对全栈来说都是必备的. 系统的选择 Linux发行版本大体分为两类,一类是商业公司维护的发行版本,一类是 ...

  6. VIO概述 On-Manifold Preintegration for Real-Time Visual--Inertial Odometry

    目前的研究方向可以总结为在滤波算法中实现高精度,在优化算法中追求实时性.当加入IMU后,研究方向分为松耦合和紧耦合,松耦合分别单独计算出IMU测量得到的状态和视觉里程计得到的状态然后融合,紧耦合则将I ...

  7. 使用materialization

    explain select `countries`.`id` AS `id`,`countries`.`sortname` AS `sortname`,`countries`.`name` AS ` ...

  8. hdu2112HDU Today(floyd+map数组对字符串的应用)

    HDU Today Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  9. MySQL☞sign函数

    sign( )函数:判断数值的正负性,如果数值是正数,返回值是1,如果该数值是负数,返回值是-1,如果该数值是 0,返回值也是0. 格式: select sign(数值) from 表名 例子: 1. ...

  10. centos下testlink的部署(基于xampp)

    1. sudu -i 切换root用户      cd /opt切换到opt目录下(在linux下默认的下载文件目录在opt下) 执行命令下载xampp:      https://sourcefor ...