Easy way find uninitialized member variables

后端 未结 11 971
时光说笑
时光说笑 2020-11-29 22:20

I am looking for an easy way to find uninitialized class member variables.

Finding them in either runtime or compile time is OK.

Currently

11条回答
  •  广开言路
    2020-11-29 22:53

    If you're using Visual Studio, you could compile in debug mode, stop the program in the debugger and look for which variables are initialised to bytes containing 0xCC (stack) or 0xCD (heap).

    Though personally, I'd invest in a static analysis tool for a more thorough approach.

提交回复
热议问题