32 bit pointer to 64 bit pointer

Discussion in 'C++' started by Saurabh Aggrawal, Dec 9, 2004.

  1. 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
    Saurabh Aggrawal, Dec 9, 2004
    #1
    1. Advertising

  2. Saurabh Aggrawal

    msalters Guest

    Saurabh Aggrawal wrote:
    > 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
    msalters, Dec 9, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,700
    Timothy Bendfelt
    Jan 19, 2007
  2. Christian Wittrock

    16 bit pointer typecast on 16 bit system

    Christian Wittrock, Jul 3, 2006, in forum: C Programming
    Replies:
    17
    Views:
    787
  3. Replies:
    9
    Views:
    912
    Juha Nieminen
    Aug 22, 2007
  4. let_the_best_man_win

    pointer to string and then back to pointer on a 64 bit machine.

    let_the_best_man_win, Sep 27, 2007, in forum: C Programming
    Replies:
    19
    Views:
    2,230
    Charlie Gordon
    Sep 29, 2007
  5. Jeff.M
    Replies:
    6
    Views:
    155
    Lasse Reichstein Nielsen
    May 4, 2009
Loading...

Share This Page