下面的代码有什么问题(崩溃):
#include <string>
#include <iostream>
void foo(std::string str, unsigned long long val)
{
std::cout<< str<< " "<< val<< std::endl; // Crashes if commented as well
}
int main()
{
double d = 30.0;
foo("abc", d);
}Visual Studio 2012/调试/ Win32
它在x64中的效果与我们将unsigned long long更改为long long甚至unsigned long的效果一样好
此代码段崩溃。在其他场景中,函数参数的地址被更改。
我怀疑它与将double转换为unsigned long long的_stol2有关
发布于 2012-12-24 15:44:52
Submitted to Microsoft作为错误(已接受)
https://stackoverflow.com/questions/13724684
复制相似问题