int a = 0和int a(0)的差异 [英] int a = 0 and int a(0) differences
本文介绍了int a = 0和int a(0)的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
Is there a difference in C++ between copy initialization and direct initialization?
我刚开始学习C ++。
I just started to learn C++.
为了初始化一个带有值的变量,我遇到了
To initialize a variable with a value, I came across
int a = 0;
和
int a(0);
这让我很困惑。
推荐答案
int a = 0;
和 int a(0);
在机器生成代码中没有区别。它们是相同的。
int a = 0;
and int a(0);
make no difference in the machine generated code. They are the same.
以下是在Visual Studio中生成的汇编代码
Following is the assembly code generated in Visual Studio
int a = 10; // mov dword ptr [a],0Ah
int b(10); // mov dword ptr [b],0Ah
这篇关于int a = 0和int a(0)的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文