4th Chapter Expressions
1. When Decltype acts on an Lvalue object, it returns the reference type of the object. When acting on an Rvalue object, the type of the object is returned.
2. Order of Evaluation.
In C + + only && | |?: and , 4 operators are evaluated first left and right.
3. The unary plus sign operator acts on the value:
the type that will raise the current value , like Short become int type
4. The results of m% (-N) and (-M)%n with (-m)% (-N) are:
Note : The sign of the module has no effect , M The positive and negative results of the decision .
5. The relational operator satisfies the left binding law:
6. When is the increment decrement operator (such as ++x,x++) not replaceable (in the form of x+1)?
when used with iterators that do not support arithmetic operations , is a must. .
7. + +,--operator, the predecessor version returns an Lvalue object, and the back version returns an Rvalue object.
8. The post-increment operator takes precedence over the dereference operator
9. Operands can be evaluated in any order:
10. The conditional operator satisfies the right binding law:
One. bitwise operators are strongly recommended for handling unsigned or positive numbers only, because how the symbol bits are handled is machine-related.
The object of a struct struct class is a word size that needs to be aligned.
The sizeof operator does not calculate the value of its operand, so it is legal to dereference an invalid pointer in sizeof.
When sizeof acts on string and Vecvtor, only the byte size of its fixed portion is returned, and its contents are not byte-sized.
14. The Order of evaluation for the comma operator is left-to-right and its return value is the value of the right expression. So if the return value of the right expression is an lvalue, then the return value of the comma operator is also an lvalue. Note b=4 returns A reference to b ( that is, the left value )
Void* can store any address of a very important object :
Const_cast<> () will change ( and only change ) the underlying const Property of the operand. (Only pointers and references have the underlying const)
C + + Primer Learning Summary 4th Chapter Expression