知识模糊点
拷贝与赋值的区别
对象的拷贝会在初始化变量,以值的方式传递或者返回一个对象时发生;而赋值操作是在对象初始化完后,利用赋值运算符时发生的int a=3; //这是拷贝操作 int a; a=4; //这是赋值操作- 如果类成员是const、引用,或者属于某种未提供默认构造函数的类类型,我们必须通过构造函数初始化列表为这些成员提供初值。
volatilevariables
in c++,thevolatilekeyword placed before the variable indicates that the value of a variable may change between different accesses, even if it does not appear to be modified;The keywordvolatileis created for such situations and it simply stops the compiler from making any assumption about the variable. If an object is declared asvolatile, every time that variable is called its value is loaded from memory.Modern hardware may suppress and reorder certain accesses thus making use of the volatile keyword alone not safe.
1772

被折叠的 条评论
为什么被折叠?



