我正在使用 PVS-studio 将程序从 x86 转换为 x64。在 PVS-Studio 中执行分析运行时,每次使用 atlconv.h 中定义的 A2W 宏时,我都会收到以下 x64 相关警告:
V303 The function 'lstrlen' is deprecated in the Win64 system. It is safer to use the 'wcslen' function.
V104 Implicit conversion of '_convert' to memsize type in an arithmetic expression: _convert * sizeof (WCHAR)
V107 Implicit type conversion third argument '_convert * sizeof (WCHAR)' of function 'AtlW2AHelper' to 32-bit type.
由于 atlconv 超出了我的范围,我应该简单地忽略这些警告,还是在 x64 上执行 A2W 宏的首选方法是什么?
最佳答案
我相信这些 ATL 3.0 宏已被弃用。 自 ATL 7.0 以来,新的转换类可用。 http://msdn.microsoft.com/EN-US/library/87zae4a3(v=VS.120,d=hv.2).aspx
在大多数情况下,用 CA2W 类替换 A2W 宏就足够了。
关于C++:x64 不推荐使用 A2W 宏 - 替代方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21334119/