WIN32: fix declaration of UINT_PTR #149
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This code added a macro
UINT_PTR
but on W32API and MS PSDK it is declared with a typedef instead, see here:https://github.com/mingw-w32/mingw-org-wsl/blob/5ae20fb2ea2f986ba30174feafc6842f0e98fd14/w32api/include/basetsd.h#L64
https://github.com/mingw-w32/mingw-org-wsl/blob/5ae20fb2ea2f986ba30174feafc6842f0e98fd14/w32api/include/basetsd.h#L102
For this reason, it happened that:
UINT_PTR
is always undefined because it's a typedef, when compiling for Windows on both MINGW and MSVC.HAVE_UINTPTR_T
is handled by autoconf configure script, but not by CMakeLists.txt. So, when compiling with CMake,HAVE_UINTPTR_T
is also always undefined.For this reasons, when compiling on 64bit for Windows,
UINT_PTR
was set tounsigned long
, by overwriting the system type with this macro. In my opinion, the best way to avoid malfunctions and complains from MINGW and MSVC when compiling for 64bit is to not overload that system type with this macro whenWIN32
is defined.