天天看點

A tour of C++A tour of C++ Book Note Day1

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

繼續閱讀