1. Constant Folding ( example )
At the time of the compiler parsing, the constant expression is evaluated, and the expression is substituted with the evaluated value to put into the constant table. Can be counted as a compilation optimization;
Because in the process of optimization, the compiler will replace all of the const with content, this appears in the pre-compilation stage, but in the run phase, the const variable memory stored in the things may indeed have changed;
2.
1 time_t t; 2 t = Clock (); // The time the program consumes CPU from boot to function call 3 time (&t); // Get system Time 4 t = localtime (); // Convert a UTC time to local time
3. "Deep copy": Static members are not copied (example)
A static member of a class is common to instances of all classes, stored in a global (static) zone, and only one copy, whether inherited, instantiated, or copied, is a copy;
4. SizeOf operation of reference type: the size of the space occupied by the referenced object; sizeof (char &) = 1; 5. The "Call order" of the derived class constructor: 1) The completion of the whole block memory of the object, which is done automatically by the system when the constructor is called, 2) calls the constructor of the base class to complete the initialization of the base class member; 3) if the derived class contains an object member, a const member, or a reference member, You must complete its initialization in the initialization table; 4) The derived class constructor body executes; 6. STL's "Primary container": The first level container refers to the container element itself is the basic type, the non-combination type, has the vector,deque,list; 7. The middle of "comma expression" cannot be empty, there must be an expression (example) of 8. Two threads execute the following code concurrently, assuming that a is a global variable and initially 1, then the following output () is possible?
void foo () { + +A; printf ("", a);}
A:3, 2 b:2, 3 C:3, 3 D:2, 2
Resolve the key points: (1) Two threads can be preempted at any time, (2) ++a and printf are not atomic instructions, can be interrupted at any time, (3) function Printf,a as a parameter stack, a re-transform will not affect the output (printf is actually printing the parameters of the stack, is the value copy of the stack variable); 9.
C + + knowledge point collation (i)