Uninitialized memory blocks in VC++

前端 未结 15 1277
鱼传尺愫
鱼传尺愫 2020-12-19 08:49

As everyone knows, the Visual C++ runtime marks uninitialized or just freed memory blocks with special non-zero markers. Is there any way to disable this behavior entirely w

15条回答
  •  一整个雨季
    2020-12-19 09:08

    That is actually a very nice feature in VC++ (and I believe other compilers) because it allows you to see unallocated memory for a pointer in the debugger. I will think twice before disabling that functionality. When you delete an object in C++ you should set the pointer to NULL in case something later tries to delete the object again. This feature will allow you to spot the places where you forgot to set the pointer to NULL.

提交回复
热议问题