A tour of C++ Book Note Day1
1. The Basics
**Just for share my note when I reading the book. If you want to discuss what interests you, you can write in the comments section. If there is a dispute, you can corret it!**
1.1 Introduction
introdution quote1
- 这本书不在于过多的讲解C++的语法,而是去讲C++为什么要这样,稍微深层理解C++背后的含义
C++’s model of memory and computation, and the basic mechanisms for organizing code into a program ^quote1
1.2 Programs
Programs/std quote2
- C++的标准库是由C++语言所实现的,而不是通过其他复杂操作
The standard-library components are perfectly ordinary C++ code provided by every C++ implementation. ^quote2
Programs/trans1 quote3
- 因此,C++标准库能够被C++自身实现,而对于机器语言或者线程上下文切换之类的事情使用的比较少
That is, the C++ standard library can be implemented in C++ itself and is (with very minor uses of machine code for things such as thread context switching). ^quote3
Programs/trans2 quote4
- 这意味着,C++就算面对要求极其苛刻的系统编程任务也能保证充足的表现力和效率性
This implies that C++ is sufficiently expressive and efficient for the most demanding systems programming tasks. ^quote4
Programs/trans3 quote5
- 因此,每一种实例的类型(例如,对象、值、变量名和表达式)的使用范围和作用都必须被编译器所知道
That is, the type of every entity (e.g., object, value, name, and expression) must be known to the compiler at its point of use ^quote5
Programs/trans4 quote6
- 对象的类型决定了一系列对其适用的操作以及它在内存中的布局
The type of an object determines the set of operations applicable to it and its layout in memory. ^quote6
1.2.1 Hello World
HelloWorld/trans1 quote7
- main()函数返回的整数值,如果有的话,就是该程序对“system”的返回值
- main()函数返回的非零值,意味着运行失败
The int integer value returned by main(), if any, is the program’s return value to “the system.”
A nonzero value from main() indicates failure. ^quote7