对32位和64位架构使用C ++ InterlockedIncrement功能的最佳方法是什么? (有分开的功能)
有没有比使用#if _W64
预处理器命令更好的方法?
答案 0 :(得分:0)
最简单的解决方案,因为您正在使用C ++:
inline LONGLONG __cdecl InterlockedIncrement(LONGLONG volatile *Addend)
{
return InterlockedIncrement64(Addend);
);
现在,您可以在32位和64位构建中无条件地对32位或64位变量调用InterlockedIncrement
。