When do C++ POD types get zero-initialized?

前端 未结 5 1859
隐瞒了意图╮
隐瞒了意图╮ 2020-12-10 03:23

Coming from a C background, I\'ve always assumed the POD types (eg ints) were never automatically zero-initialized in C++, but it seems this was plain wrong!

My unde

5条回答
  •  执笔经年
    2020-12-10 03:51

    They don't. Debug bits versions might do this, but typically it's just placed into memory, and initialized to whatever happened to be the value in memory.

提交回复
热议问题