Chapter 1 The Basics
Which two are defined by The ISO C++ standard?
- Core language features, such as built-in types (e.g.,
int) and loops (e.g.,
- Standard-library componets, such as containers (e.g.
map) and I/O operations(e.g.,
The standard-library componets are perfectly ordinary C++ code provided by every C++ implementations. That is, the c++ library can be implemented in C++ itself and is (with very minor use of machine code for things such as thread context switch).
C++ is a statically typed language,or dynamic?
c++ is a statically typed language. That is, the type of every entity(e.g., object, value, name and expression) must be known to the complier at its point of use(compiler time). Dynamic programming language in computer science is a class of high-level programming languages, which at runtime, execute many common programming behaviours that static programming languages perform during compilation.
Three tasks of function declaration
- A function declaration gives the name of the function
- the type of the value returned (if any)
- and the number and types of the arguments that must be supplied in call.
How to write comprehensible code?
We want our code to be comprehensible, because that is the first step on the way to maintaionability.
- The first step to comprehensibility is to break computational task into meaningful chunks (represented as funcations and classes) and name those.
- The number of errors in code correlates strongly with the amount of code and the complexity of the code. Both problems can be addressed by using more and shorter functions.
recommend links: Six ways to write more comprehensible code
- 核心语言特性, 比如内建类型, char和int, 和循环, 比如for和 while循环
- 标准库组件, 比如容器类型, vector, map, I/O操作
其中标准库都是很普通的C++实现, 也就是说, C++的标准库可以由C++自身实现, 以及少量的机器码(比如线程上下文切换).