As far as C language is concerned, local variables generally exist on the stack; unless it is some leaf function, a small number of local variables are placed directly in registers. The value in the stack is, of course, unknown by default. If the compiler generates a piece of code that specifically initializes local variables on the stack before referencing them, then it is similar to g++'s approach; otherwise, it is VS's approach.
It should be yes, vs compiler, local built-in type variables are not initialized. C++ pursues higher performance. If it is not necessary, the C++ compiler will generally not do extra work, such as default initialization of variables. . .
As far as C language is concerned, local variables generally exist on the stack; unless it is some leaf function, a small number of local variables are placed directly in registers. The value in the stack is, of course, unknown by default. If the compiler generates a piece of code that specifically initializes local variables on the stack before referencing them, then it is similar to g++'s approach; otherwise, it is VS's approach.
It should be yes, vs compiler, local built-in type variables are not initialized. C++ pursues higher performance. If it is not necessary, the C++ compiler will generally not do extra work, such as default initialization of variables. . .