You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
case true:
string file_name; // 错误:控制流绕过一个隐式初始化的变量
int ival = 0;
int jval; // 正确:因为jval没有初始化
break;
case false:
jval = next_num();
if (file_name.empty())
// ...
这一块给了一个例子,对于其中的一个注释不太理解。
为什么file_name会隐式初始化而jval不会?是因为string不是内置类型吗?所有的非内置类型都会隐式初始化?
另外,int类型没有初始化而输出时其实会输出0,那这个int类型到底有没有初始化呢?(用的mac上的g++,不知道是不是有影响)
谢谢!
The text was updated successfully, but these errors were encountered: