C++: A2W macro deprecated for x64 - alternatives?

2.8k views Asked by At

I am using PVS-studio in converting a program to x64 from x86. Upon the execution of an analysis run in PVS-Studio I get the following x64 related warnings for every use of the A2W macro defined in atlconv.h:

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.

Since the atlconv is ouside of my reach, should I simply ignore these warnings or what would be the preferred way otherwise of doing the A2W macro on x64?

2

There are 2 answers

0
10100111001 On BEST ANSWER

In case this helps anyone else, I did solve it using the CStringW constructor.

1
Andrey On

I believe that these ATL 3.0 macros are deprecated. Since ATL 7.0 new conversion classes are available. http://msdn.microsoft.com/EN-US/library/87zae4a3(v=VS.120,d=hv.2).aspx

In most cases it will be enough to replace A2W macro with CA2W class.