How INT_PTR datatype works between 64Bit and 32Bit RRS feed

  • Question

  • Hi

    I would like to know a bit more information on INT_PTR data type working.

    Since INT_PTR is a precision pointer data type and it takes size of 8 bytes in 64 bit and 4 bytes in 32 bit correspondingly,

    suppose during the serialization process, if i have to serialize the INT_PTR data type between 64 bit and 32bit, then how does it works.


    CArray<int*, int*>arrTest;


    Write : ar << arrTest.GetSize()

    Read :

    INT_PTR nCount = arrTest.GetSize()

    ar >> nCount


    Now if i have save the data in 64bit project ( Write Operation ) and going to read that data which will be a project file in my case ( Read Operation), how does INT_PTR data type works.

    How is byte shifting or data truncation handled between the two platforms by these pointer precision data types ?



    Anur RS

    Friday, May 7, 2010 12:44 AM


  • When converting 32-bit to 64-bit, signed number are sign extended and unsigned numbers are 0 extended.

    Sign extension means filling the high order bytes with what ever value is in the sign bit.

    Zero extension means filling the high order bytes with zeros.

    Truncation only means removing the high order bytes.

    Microsoft MVP (Visual C++)
    • Marked as answer by Yi Feng Li Thursday, May 13, 2010 2:23 AM
    Friday, May 7, 2010 2:02 AM