|
From: Prajakta on 13 May 2008 00:45 Thanks David I tried using size_t b and the issue got resolved. Not the code is compiling on both 32 & 64 bit windows. "David Wilkinson" wrote: > Prajakta wrote: > > HI, > > > > I am porting 32 bit application on 64-bit windows. > > I am using Visual studio 2005 for building the application. > > > > The existing code consists of a function call: > > > > LPDWORD b; > > LPWSTR a = new WCHAR[(unsigned int) b]; > > > > While building this code for 64-bit i get warning > > warning C4311: 'type cast' : pointer truncation from 'LPDWORD' to 'unsigned > > int' > > > > As the pointer size changes from 4 bytes to 8 bytes. > > > > Please provide me solution for this type of warning. > > > > Prajakta: > > The solution for this kind of warning is to use the correct type in the first place. > > size_t b = 10; > LPWSTR a = new WCHAR[b]; > > Using LPDWORD in particular makes no sense whatever. > > -- > David Wilkinson > Visual C++ MVP > |