About C++ basic knowledge, you must know these professional terms(2)

The road is hindered and long, and the line is coming. Keep your head down and work hard, if you don't talk, you will be a blockbuster! Come on, Sao Nian!

Preface

  Based on "C++ Primer", Chapter 2 "Variables and Basic Types" summarized;

  Tip: Be good at using the Ctrl + F shortcut keys to quickly search for relevant content!

1 Chapter Summary

  1. Type is the basis of C++ programming;
  2. The type specifies the storage requirements of its objects and the operations that can be performed;
  3. Types are divided into non-constants and constants. Constant objects must be initialized, and their value cannot be changed once initialized;
  4. In addition, you can also define composite types, such as pointers and references; the definition of composite types is based on other types;
  5. The C++ language allows users to customize types in the form of classes. The C++ library provides a set of high-level abstract types through classes, such as input and output and string.

2 Glossary text

  • 地址(address) : Is a number, according to which you can find a byte in the memory.

  • 别名声明(alias declaration) : Define a synonym for another type: use the format "name=type" to use the name as a synonym for that type.

  • 算数类型(arithmetic type) : Built-in types such as Boolean values, characters, integers, and floating-point numbers.

  • 数组(array) : Is a data structure that stores a group of unnamed objects, which can be accessed through indexes.

  • auto : Is a type specifier that infers the type of the variable through the initial value of the variable.

  • 基本类型(base type) : It is a type specifier, which can be modified with const, before the declarator in the statement statement. Basic types provide the most common data types on which to build declarators.

  • 绑定(bind) : Associate a name with a given entity, using the name means using the entity. For example, reference is to bind a name to an object.

  • 字节(byte) : The smallest addressable unit in the memory, the byte of most machines occupies 8 bits.

  • 类成员(class member) : The component of the class.

  • 复合类型(compound type) : It is a type, and its definition is based on other types.

  • const : Is a type modifier used to describe objects that never change. Once a const object is defined, it cannot be assigned a new value, so it must be initialized.

  • 常量指针(const pointer) : It is a pointer whose value never changes.

  • 常量引用(const reference) : Is a customary name, meaning a reference to a constant.

  • 常量表达式(const expression) : An expression that can be calculated and obtained at compile time.

  • constexpr : Is a function used to represent a constant expression.

  • 转换(conversion) : The process of transforming one type of value into another type of value. The C++ language supports conversion between built-in types.

  • 数据成员(data member) : The data elements that make up the object. Each object of the class has a copy of the data members of the class. Data members can be initialized at the same time they are declared inside the class.

  • 声明(declaration) : Claim that there is a variable, function, or type defined elsewhere. The name must be defined or declared before it can be used.

  • 声明符(declarator) : Is part of the declaration, including the defined name and type modifiers, which may or may not have type modifiers.

  • decltype : Is a type specifier, the type is inferred from the variable or expression.

  • 默认初始化(default initialization) : The initialization behavior performed when the object is not explicitly assigned an initial value. The initialization behavior of the class object performed by the class itself. The built-in type objects of the global scope are initialized to 0; the objects of the local scope have undefined values ​​if they are not initialized.

  • 定义(definition) : To apply for storage space for a certain type of variable, you can choose to initialize the variable. The name must be defined or declared before it can be used.

  • 转义序列(escape sequence) : Characters, especially alternative forms of non-printable characters. The escape begins with a backslash, followed by a character, or no more than 3 octal digits, or the letter x plus 1 hexadecimal digit.

  • 全局作用域(global scope) : Scope outside of all other scopes.

  • 头文件保护符(header guard) : Use preprocessing variables to prevent header files from being repeatedly included in a file.

  • 标识符(identifier) : The sequence of characters that make up the name, and the identifier is case sensitive.

  • 类内初始值(in-class initializer) : The initial value provided at the same time when declaring the data members of the class must be placed on the right side of the equal sign or in curly braces.

  • 在作用域内(in scope) : The name is visible in the current scope.

  • 被初始化(initialized) : Variables are assigned initial values ​​at the same time they are defined. Variables should generally be initialized.

  • 内层作用域(inner scope) : Scopes nested within other scopes.

  • 整形(integral type) : See arithmetic types.

  • 列表初始化(list initialization) : An initialization form that uses curly braces to put one or more initial values ​​together.

  • 字面值(literal) : Is a value that cannot be changed, such as numbers, characters, strings, etc. Single quotes are character literals, and double quotes are string literals.

  • 局部作用域(local scope) : Is the customary name for block scope.

  • 底层 const (low-level const) : A const that does not belong to the top level, if the type is defined by the bottom constant, it cannot be ignored.

  • 成员(member) : The component of the class.

  • 不可打印字符(nonprintable character) : Characters that do not have a visible form, such as control characters, backspace, and newline characters.

  • 空指针(null pointer) : A pointer with a value of 0. The null pointer is legal but does not point to any object.

  • nullptr : Is a literal constant representing a null pointer.

  • 对象(object) : Is an area of ​​memory with a certain type, and variables are named objects.

  • 外层作用域(outer scope) : Scope with other scopes nested.

  • 指针(pointer) : It is an object, which stores the address of an object, or the next address after the storage area of ​​an object, or 0.

  • 指向常量的指针(pointer to const) : It is a pointer that stores the address of a constant object. A pointer to a constant cannot be used to change the value of the object it refers to.

  • 预处理器(preprocessor) : A section of program executed during C++ compilation.

  • 预处理变量(preprocessor variable) : Variables managed by the preprocessor. Before the program is compiled, the preprocessor is responsible for replacing the preprocessing variables in the program with its real value.

  • 引用(reference) : Is the alias of an object.

  • 对常量的引用(reference to const) :是一个引用,不能用来改变它所绑定对象的值。对常量的引用可以绑定常量对象,或者非常量对象,或者表达式的结果。

  • 作用域(scope) :是程序的一部分,在其中某些名字有意义。C++ 有几级作用域:

    • 全局(global) :名字定义在所有其他作用域之外。
    • 类(class) :名字定义在类内部。
    • 命名空间(namespace) :名字定义在命名空间内部。
    • 块(block) :名字定义在块内部。

  名字从声明位置开始直至声明语句所在的作用域末端为止都是可用的。

  • 分离式编译(separate compilation) :把程序分割为多个单独文件的能力。

  • 带符号类型(signed) :保存正数、负数或 0 的整型。

  • 字符串(string) :是一种库类型,表示可变长字符序列。

  • struct :是一个关键字,用于定义类。

  • 临时值(temporary) :编译器在计算表达式结果时创建的无名对象。为某表达式创建了一个临时值,则此临时值将一直存在直到包含有该表达式的最大的表达式计算完成为止。

  • 顶层 const (top-level const) :是一个 const ,规定某对象的值不能改变。

  • 类型别名(type alias) :是一个名字,是另外一个类型的同义词,通过关键字 typedef 或别名声明语句来定义。

  • 类型检查(type checking) :是一个过程,编译器检查程序使用某给定类型对象的方式与该类型的定义是否一致。

  • 类型说明符(type specifier) :类型的名字。

  • typedef :为某类型定义一个别名。当关键字 typedef 作为声明的基本类型出现时,声明中定义的名字就是类型名。

  • 未定义(undefined) :即 C++ 语言没有明确规定的情况。不论是否有意为之,未定义行为都可能引发难以追踪的运行时错误、安全问题和可移植性问题。(举例:vector向量使用 v[],如果下标越界,则函数行为未定义;但是使用 v.at(),虽然也有错误,但是会抛出异常)

  • 未初始化(uninitialized) :变量已定义但未被赋予初始值。一般来说,试图访问未初始化变量的值将引发未定义行为。

  • 无符号类型(unsigned) :保存大于等于 0 的整型。

  • 变量(variable) :命名的对象或引用。C++ 语言要求变量要先声明后使用。

  • void* :可以指向任意非常量的指针类型,不能执行解引用操作。

  • void 类型 :是一种有特殊用处的类型,既无操作也无值。不能定义一个 void 类型的变量。

  • 字(Word) :在指定机器上进行整数运算的自然单位。一般来说,字的空间足够存放地址。32 位机器上的字通常占据 4 个字节。

  • & 运算符(& operator) :取地址运算符。

  • * 运算符(* operator) :解引用运算符。解引用一个指针将返回该指针所指的对象,为解引用的结果复制也就是为指针所指的对象赋值。

  • #define :是一条预处理指令,用于定义一个预处理变量。

  • #endif :是一条预处理指令,用于结束一个 #ifdef 或 #ifndef 区域。

  • #ifdef :是一条预处理指令,用于判断给定的变量是否已经定义。

  • #ifndef :是一条预处理指令,用于判断给定的变量是否尚未定义。

如果文章内容有误,麻烦评论/私信多多指教,谢谢!如果觉得文章内容还不错,留个赞呗,您的点赞就是对我最大的鼓励,谢谢您嘞!

Guess you like

Origin blog.csdn.net/Fighting_Boom/article/details/106603743