C/C++ 之间的区别Windows 中的数据类型
在 Windows 系统中,不同的数据类型具有相同的大小(请参阅 http://msdn.microsoft.com/en-us/library/s3f49ktz(v=VS.100).aspx)我忍不住想知道 double 和 long double 之间有区别吗或者在 long 和 int 之间?当我问差异时,我指的是计算上的差异。
In Windows systems different data types have the same size (see http://msdn.microsoft.com/en-us/library/s3f49ktz(v=VS.100).aspx) I couldn't help but wonder is there a difference between double and long double or between long and int? When I ask about differences I mean difference in calculations.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 C++ 标准,它们可能不同,但并非必须如此。保证
long
版本始终至少与其非long
版本一样大。一般来说,数据类型的大小取决于您运行的系统。因此,虽然您的系统上可能没有差异,但其他系统上可能会有差异。如果您想编写可移植代码,您必须意识到这一点。
According to the C++-standard they may be different, but don't have to. The guarantee is that the
long
versions are always at least as large as their non-long
counterparts.In general, the sizes of data-types depend on the system on which you are running. So while there may not be a difference on your system, there may be on others. You have to be aware of that if you want to write portable code.