C ++ cow brush off questions day33

In fact, there is auto 1.C language, not only in C ++. This points to remember

2. undefined behavior

Simply put, undefined behavior refers to unspecified behavior of the C language standard. The compiler might not complain, but these actions compiler will handle, so that different compiler different results, anything can happen, this is a great risk, so we should try to avoid this situation occur.

Such examples are many:

With a variety of expression operators,

The same statement order of evaluation of each parameter,

Modify the value by a constant const pointer. ETC. .

3.C ++ constant in

Symbolic constants: not character constant symbolic constant, an identifier can be used to represent a constant, this identifier is called symbol constant. Its characteristics are written in the compiled code area, not addressed, can not be changed, are part of the instruction. #define and const are constants symbols defined in two ways.
Logical constants: true and false constants divided into six: integer constant, real constants, character constants, a string constant, a symbolic constant, logical constants
4. unsigned and signed integers
When symbols and unsigned compare operations (==, <,>, <=,> =), there is implicit conversion would be signed unsigned number (i.e., the bottom of the same complement, but this number from signed number into an unsigned number), such as the above (a + b)> 0 the comparison operation, a + b = -2. When this number comparing operation, as is the unsigned number, which is far greater than 0
The Commonwealth sizeof
each member of the union (union) of the start address is stored in the same, may be stored every moment only one member, so it is required to satisfy the memory allocation unit time points: 
1. Generally speaking, a common type of actual take up storage space for the storage space occupied by the longest member; 
2. If the longest storage cell type to the other members (if the array, the length of whichever type of data, for example, int a [5] 4 ) does not satisfy the divisible relation, the space is automatically extended to the maximum possible size of all metadata divisible up.

Guess you like

Origin www.cnblogs.com/Tonarinototoro/p/11620338.html