32 bit pointer to 64 bit pointer

  • Thread starter Saurabh Aggrawal
  • Start date
S

Saurabh Aggrawal

Hi,
I am porting a 32-bit application to 64-bit application (AMD).
I am getting the error:

XXX.cpp(49) : warning C4267: '=' : conversion from 'size_t' to 'long',
possible loss of data
XXX.cpp(84) : error C2664: 'HRESULT BinValue::get(const unsigned char
*&,long &)' : cannot convert parameter 1 from 'unsigned char *' to
'const unsigned char *&'
Conversion loses qualifiers
NMAKE : fatal error U1077: 'cl' : return code '0x2'

In 64 bit AMD programming the data type unsigned INT_PTR (unsigned
int*) is UINT_PTR and for unsigned LONG_PTR (unsigned long*) is
ULONG_PTR. What should be the data type for unsigned char* ????
Respects,
Saurabh Aggrawal
Sr. S/w Programmer
 
M

msalters

Saurabh said:
Hi,
I am porting a 32-bit application to 64-bit application (AMD).
I am getting the error:

XXX.cpp(49) : warning C4267: '=' : conversion from 'size_t' to 'long',
possible loss of data

That is of course your 32/64 bits problem. A number representing
4Gb of memory won't fit in a long.
XXX.cpp(84) : error C2664: 'HRESULT BinValue::get(const unsigned char
*&,long &)' : cannot convert parameter 1 from 'unsigned char *' to
'const unsigned char *&'
Conversion loses qualifiers

The compiler is correct. The get() method can change both arguments;
both are non-const references. However, the type of the first
argument does not match the formal parameter. The compiler cannot
introduce a temporary (the usual solution), because temporaries
cannot be bound to a non-const reference.
In 64 bit AMD programming the data type unsigned INT_PTR (unsigned
int*) is UINT_PTR and for unsigned LONG_PTR (unsigned long*) is
ULONG_PTR. What should be the data type for unsigned char* ????

Not important. The type of unsigned char* is unsigned char*. The
type of int* is int*, the type of unsigned int* is unsigned int*,
etcetera. INT_PTR is just a shorter namer, but not a type.
Regards,
Michiel Salters
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top