Skip to content

Commit 6b91126

Browse files
book: typo fixes (#148)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 6dc07f6 commit 6b91126

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

book/en-us/00-preface.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ order: 0
1010

1111
## Introduction
1212

13-
C++ user group is a fairly large. From the advent of C++98 to the official finalization of C++11, it has accumulated over a decade. C++14/17 is an important complement and optimization for C++11, and C++20 brings this language to the door of modernization. The extended features of all these new standards are given to the C++ language. Infused with new vitality.
13+
C++ user group is fairly large. From the advent of C++98 to the official finalization of C++11, it has accumulated over a decade. C++14/17 is an important complement and optimization for C++11, and C++20 brings this language to the door of modernization. The extended features of all these new standards are given to the C++ language. Infused with new vitality.
1414
C++ programmers, who are still using **traditional C++** (this book refers to C++98 and its previous C++ standards as traditional C++), may even amazed by the fact that they are not using the same language while reading modern C++ code.
1515

1616
**Modern C++** (this book refers to C++11/14/17/20) introduces a lot of features into traditional C++, which makes the whole C++ become language that modernized. Modern C++ not only enhances the usability of the C++ language itself, but the modification of the `auto` keyword semantics gives us more confidence in manipulating extremely complex template types. At the same time, a lot of enhancements have been made to the language runtime. The emergence of Lambda expressions has made C++ have the "closure" feature of "anonymous functions", which is almost in modern programming languages ​​(such as Python/Swift/.. It has become commonplace, and the emergence of rvalue references has solved the problem of temporary object efficiency that C++ has long been criticized.
@@ -31,7 +31,7 @@ In conclusion, as an advocate and practitioner of C++, we always maintain an ope
3131

3232
The book claims "On the Fly". Its intent is to provide a comprehensive introduction to the relevant features regarding modern C++ (before 2020s).
3333
Readers can choose interesting content according to the following table of content to learn and quickly familiarize the new features you would like to learn.
34-
Readers should aware that all of these features are not required. It should be leart when you really need it.
34+
Readers should aware that all of these features are not required. It should be learnt when you really need it.
3535

3636
At the same time, instead of grammar-only, the book introduces the historical background as simple as possible of its technical requirements, which provides great help in understanding why these features comes out.
3737

book/en-us/01-intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ You should first compile the C code with `gcc`:
9393
gcc -c foo.c
9494
```
9595

96-
Compile and output the `foo.o` file, and link the C++ code to the `.o` file using `clang++` (or both compile to `.o` and then unlink them together):
96+
Compile and output the `foo.o` file, and link the C++ code to the `.o` file using `clang++` (or both compile to `.o` and then link them together):
9797

9898
```bash
9999
clang++ 1.1.cpp foo.o -std=c++2a -o 1.1

book/en-us/03-runtime.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ through copy constructors and assignment operators,
399399
but in order to implement the movement of resources,
400400
The caller must use the method of copying and then destructing first,
401401
otherwise you need to implement the interface of the mobile object yourself.
402-
Imagine moving to move your home directly to your new home instead of
402+
Imagine moving your home directly to your new home instead of
403403
copying everything (rebuy) to your new home.
404404
Throwing away (destroying) all the original things is a very anti-human thing.
405405
@@ -607,7 +607,7 @@ constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type&& __t) noexcep
607607
```
608608
609609
In this implementation, the function of `std::remove_reference` is to eliminate references in the type.
610-
And `std::is_lvalue_reference` is used to check if the type derivation is correct, in the second implementation of `std::forward`
610+
And `std::is_lvalue_reference` is used to check if the type derivation is correct, in the second implementation of `std::forward`.
611611
Check that the received value is indeed an lvalue, which in turn reflects the collapse rule.
612612
613613
When `std::forward` accepts an lvalue, `_Tp` is deduced to the lvalue, so the return value is the lvalue; and when it accepts the rvalue,

book/en-us/07-thread.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ int main() {
303303
}
304304
```
305305

306-
Of course, not all types provide atomic operations because the feasibility of atomic operations depends on the architecture of the CPU and whether the type structure being instantiated satisfies the memory alignment requirements of the architecture, so we can always pass Std::atomic<T>::is_lock_free` to check if the atom type needs to support atomic operations, for example:
306+
Of course, not all types provide atomic operations because the feasibility of atomic operations depends on the architecture of the CPU and whether the type structure being instantiated satisfies the memory alignment requirements of the architecture, so we can always pass `std::atomic<T>::is_lock_free` to check if the atom type needs to support atomic operations, for example:
307307

308308
```cpp
309309
#include <atomic>
@@ -366,7 +366,7 @@ Weakening the synchronization conditions between processes, usually we will cons
366366
x.store(2)
367367
```
368368
369-
Under the order consistency requirement, `x.load()` must read the last written data, so `x.store(2)` and `x.store(1)` do not have any guarantees, ie As long as ``x.store(2)` of `T2` occurs before `x.store(3)`.
369+
Under the order consistency requirement, `x.load()` must read the last written data, so `x.store(2)` and `x.store(1)` do not have any guarantees, ie As long as `x.store(2)` of `T2` occurs before `x.store(3)`.
370370
371371
3. Causal consistency: its requirements are further reduced, only the sequence of causal operations is guaranteed, and the order of non-causal operations is not required.
372372

book/en-us/09-others.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ the external will not trigger. For instance:
8383
try {
8484
may_throw();
8585
} catch (...) {
86-
std::cout << "exception captured from my_throw()" << std::endl;
86+
std::cout << "exception captured from may_throw()" << std::endl;
8787
}
8888
try {
8989
non_block_throw();
@@ -100,7 +100,7 @@ try {
100100
The final output is:
101101

102102
```
103-
exception captured, from my_throw()
103+
exception captured, from may_throw()
104104
exception captured, from non_block_throw()
105105
```
106106

0 commit comments

Comments
 (0)