__w64

I am trying to port an application from 32-bit to 64-bit windows environment. There are a lot of warnings like these when i compile my code on 64-bit :-

mbtext.cxx(2249) : warning C4244: 'argument' : conversion from '__w64 int' to 'int', possible loss of data
mbtext.cxx(2354) : warning C4244: 'argument' : conversion from '__w64 int' to 'int', possible loss of data

This warning is at lot of places.
"__w64" : Not much help is available to know more about this type.

Please suggest appropriate resolution for this warning.

Thanks,
- Navin


Answer this question

__w64

  • George Cai

    __w64 is not a type! __w64 says that in a 64bit envioronment this variable sized type (variable sized depeneding on the compiler), and on a 32bit compiler its 32bit. So assigning this types from one to another fires the warning!

    Example: DWORD_PTR is a DWORD that is allowed to carry a pointer, so it is 64bit wide on a 64bit system. Assigning it to a DWORD (32bit) value fires the above warning!

  • Rubal Jain

    This warning is a result of /Wp64.  See docs on /Wp64.

    This is a portability warning.  It is telling you that the code you're writing may not be portable to a 64-bit architecture. 

    The resolution is to either eliminate the explicit or implicit cast that would shorten a 64-bit type to a 32-bit type.  Or, if you will never compile this code to a 64-bit machine, disable /Wp64 (Detect 64-bit Portability Errors under the C/C++ settings).

    Note to Daniel Rieck: this thread really belongs in the Visual C++ language forum.  This is not a .NET Framework question.

  • __w64