P
Paul Forgey
When building on a 32 bit target, the following:
Something *somethingPtr;
.....
SetWindowLongPtr (wnd, GWLP_USERDATA, (LONG_PTR) somethingPtr);
warns of a conversion from LONG_PTR to LONG. Uhh.. the whole point of the
_ptr types is to describe, in a platform independent manner, a numeric type
whose size will hold a pointer. I have to cast it from something to avoid
another (correct) warning because it's a pointer type being cast to an
integer.
This is happening because on non-win64, SetWindowLongPtr is actually
SetWindowLong, which takes a LONG type. Fine and good ,but why then is the
compiler warning me the LONG_PTR -> LONG is a possible loss of data while
they should really be aliases of the same type?
So while this will work great on win64, there's no way to avoid a warning on
one platform or the other without an #ifdef, something the _ptr types are
there to avoid having to do. WTF?! Am I missing yet another ugly __MACRO
that needs to be set to something?
Something *somethingPtr;
.....
SetWindowLongPtr (wnd, GWLP_USERDATA, (LONG_PTR) somethingPtr);
warns of a conversion from LONG_PTR to LONG. Uhh.. the whole point of the
_ptr types is to describe, in a platform independent manner, a numeric type
whose size will hold a pointer. I have to cast it from something to avoid
another (correct) warning because it's a pointer type being cast to an
integer.
This is happening because on non-win64, SetWindowLongPtr is actually
SetWindowLong, which takes a LONG type. Fine and good ,but why then is the
compiler warning me the LONG_PTR -> LONG is a possible loss of data while
they should really be aliases of the same type?
So while this will work great on win64, there's no way to avoid a warning on
one platform or the other without an #ifdef, something the _ptr types are
there to avoid having to do. WTF?! Am I missing yet another ugly __MACRO
that needs to be set to something?