首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

问一个关于MAX函数64位上编译的有关问题

2012-11-01 
问一个关于MAX函数64位下编译的问题我用的是VC2005 +SP1 win7 64bitstd::max(m_iMaxStackSize, m_iStackPo

问一个关于MAX函数64位下编译的问题
我用的是VC2005 +SP1 win7 64bit 

std::max(m_iMaxStackSize, m_iStackPos)函数的参数分别是 size_t 和 unsigned int两种类型的,32位编译没任何问题,也没有警告,64位报错如下

1>.\muParserBytecode.cpp(255) : error C2780: 'const _Ty &std::max(const _Ty &,const _Ty &,_Pr)' : expects 3 arguments - 2 provided
1> C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\xutility(3190) : see declaration of 'std::max'
1>.\muParserBytecode.cpp(255) : error C2782: 'const _Ty &std::max(const _Ty &,const _Ty &)' : template parameter '_Ty' is ambiguous
1> C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\xutility(3182) : see declaration of 'std::max'
1> could be 'unsigned int'
1> or 'size_t

请问除了把unsigned int参数强制转换为size_t类型外,还有没有更好的解决办法? 谢谢大家.

[解决办法]
x64下 分别sizeof(size_t) sizeof(unsigned int)看看,大小应该不一样。
最好用MAX宏
[解决办法]
size_t 64位下是8字节。
unsigned int 是4字节。

热点排行