1.const modifier pointer
(1)const int *P=&X: Cannot modify The contents of the *p, but can let the pointer p Point to another address, like int const *P
(2)int *const p=&x: The pointer itself is a constant, fixed to a variable, so p is immutable, but *p Variable
2.const modifier function
(1) before the function parameter , const is the protection pointer, the value passed by reference cannot be modified
(2) The member function of the class is followed by a const, the function cannot modify the member variable, the non- const member function cannot be called
3.Volatile
Access registers are much faster than accessing memory, and compilers tend to store frequently used variables in registers in order to ensure access speed, which can lead to dirty reading of variables. Volatile -Modified variables are read from memory every time, preventing dirty reads
4.Static
(1) hide. When we compile multiple files at the same time, all global variables and functions that do not have a static prefix have global visibility, so use the static Define a function with the same name and a variable of the same name in different files without worrying about naming conflicts.
(2) The second function of static is to keep the contents of a variable persistent. Variables stored in the static data area are initialized at the start of the program and are the only one initialized. A total of two variables are stored in static storage: Global variables and static variables.
(3) The third function of static is initialized to 0 by default . in fact, global variables also have this property, because global variables are also stored in the static data area. In the static data area, all bytes in memory default values are 0x, sometimes this feature can reduce the workload of the programmer.
Keywords used by C + + for retouching