gpt4 book ai didi

c++ - 理解 C++ 标准的困惑

转载 作者:可可西里 更新时间:2023-11-01 15:09:35 33 4
gpt4 key购买 nike

在 C++98 中

12.6.2/4 : After the call to a constructor for class X has completed, if a member of X is neither specified in the constructor's mem-initializers, nor default-initialized, nor initialized during execution of the body of the constructor, the member has indeterminate value.

nor initialized during the body of the constructor 是什么意思?成员可以在构造函数体内初始化吗?

最佳答案

在构造函数主体的执行期间也没有初始化恕我直言,这是不正确的。

C++03 中的措辞已从 nor initialized(在 C++98 中)更改为 nor given a value

After the call to a constructor for class X has completed, if a member of X is neither specified in the constructor’s mem-initializers, nor default-initialized, nor value-initialized, nor given a value during execution of the body of the constructor, the member has indeterminate value.

关于c++ - 理解 C++ 标准的困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4384052/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com