在32位编译器中使用/ Wp64警告。但没有64位编译器警告(配置) [英] Warning with /Wp64 in 32 bit compiler. But no warnings with 64bit compiler(config)
问题描述
HI,
对于以下代码,我在启用/ Wp64的32位编译器中收到警告。使用VS2013版本。
但在64位编译器中没有警告。为什么?
&NBSP; &NBSP; &NBSP; &NBSP;的std ::矢量<短>我的列表;
&NBSP; &NBSP; &NBSP; std :: ostringstream logMsg;
&NBSP; &NBSP; &NBSP; logMsg<< "显示" << mylist.size()<< "结果。";
&NBSP; &NBSP; &NBSP; m_logger-> logMsg(logMsg.str());
发出警告
"警告C4267:'参数':转换自'size_t'到'unsigned int',可能丢失数据"
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP;
您好,
我正在将c ++应用程序从32位移植到64位。 vs2013。我必须为两个配置维护相同的代码。
对于下面的代码,我在启用/ Wp64的32位编译器中收到警告。但64位编译器没有警告。为什么?
&NBSP; &NBSP; &NBSP; &NBSP;的std ::矢量<短>我的列表;
&NBSP; &NBSP; &NBSP; &NBSP; ... // mylist可能包含大量元素,可能大于int size
&NBSP; &NBSP; &NBSP; std :: ostringstream logMsg;
&NBSP; &NBSP; &NBSP; logMsg<< "显示" << mylist.size()<< "结果。";
&NBSP; &NBSP; &NBSP; m_logger-> logMsg(logMsg.str());
发出警告
"警告C4267:'参数':转换自'size_t'到'unsigned int',可能丢失数据"
请帮我解决这个警告(mylist可以使用大量的元素,大于int大小)。似乎是ostringstream运算符<<不接受size_t(64位配置时为64位)
谢谢,Uralsib
HI ,
For the below code, i am getting warning , in 32 bit compiler with /Wp64 enabled. Using VS2013 version.
But no warning in 64 bit compiler. Why?
std::vector<short> mylist;
std::ostringstream logMsg;
logMsg << "showing " << mylist.size() << " results.";
m_logger->logMsg(logMsg.str());
Giving warning
"warning C4267: 'argument' : conversion from 'size_t' to 'unsigned int', possible loss of data"
Hi,
I am porting c++ application from 32 to 64 bit. vs2013 . I have to maintain same code for both configuratios.
For the below code, i am getting warning , in 32 bit compiler with /Wp64 enabled. But no warning in 64 bit compiler. Why?
std::vector<short> mylist;
...// mylist may pouplate with large number of elments , may be larger than int size
std::ostringstream logMsg;
logMsg << "showing " << mylist.size() << " results.";
m_logger->logMsg(logMsg.str());Giving warning
"warning C4267: 'argument' : conversion from 'size_t' to 'unsigned int', possible loss of data"
Please help me to solve this warnings (mylist can pouplate with large number of elments , larger than int size). It seems ostringstream operator << not accepting size_t( which is 64 bit in case of 64bit configuration)
Thanks,Uralsib
这篇关于在32位编译器中使用/ Wp64警告。但没有64位编译器警告(配置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!