C++:x64 不推荐使用 A2W 宏 - 替代方案?

标签 c++ macros 64-bit pvs-studio

我正在使用 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/

相关文章:

C++.eof。未读取文件的最后一个值

c++ - 没有匹配的函数来调用 class::class

macros - Clojure - 引用困惑

excel - 如何在 64 位 R 中写入 Excel 文件

raspberry-pi - 树莓派 3 的 64 位操作系统

python - 在 Windows 上为 Python 2.7 64 位获取 PIL 而不是 Pillow

c++ - 尝试引用已删除的函数单元测试

c++ - 修改函数以使用 SSE 内在函数

c - 如何编写 Makefile 以从一个源生成两个可执行文件?

macros - 在 SWI-Prolog 中编写宏