Storage comparison of various variables/constants in c ++:
Variable location variable type visibility storage location name connection example
--------------------------------------------
Local variables in the function. The stack in the function does not exist. Fun () {int ;}
Static variable in the function. This compilation unit is connected to fun () {static int A;} in the static data zone ;}
Function external global variables all compilation units static data areas external connections int A; Main (){}
Function external constant const int A = 100 in the compiled unit symbol table;
Const in class: What is the object lifecycle? (Not during compilation )? Class base {const size ;};
What is the life cycle symbol table of the class Enum in the class (during compilation )? Class base {Enum {size = 100 };};
Class base {static int x ;};
Class base {static const int x ;};