[AD] 64-bit intptr_t on WIndows |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: "Coordination of admins/developers of the game programming library Allegro" <alleg-developers@xxxxxxxxxx>
- Subject: [AD] 64-bit intptr_t on WIndows
- From: Matthew Leverton <meffer@xxxxxxxxxx>
- Date: Sat, 15 Aug 2009 17:59:44 -0500
Can we get something like the attached code added to Allegro 5 for
64-bit MSVC in the auto-guess types? It's taken from crtdefs.h, but I
don't think that entire file should be included, nor do I know which
compilers have it.
_WIN64 is automatically defined by 64-bit Windows compilers. The _W64
on the 32-bit one is just a portability warning and isn't strictly
necessary. I don't know if _W64 is commonly defined (as _w64) or not.
Obviously it could be shortened to checking for _WIN64 and #defining
intptr_t, but that won't play well with other Windows headers. And in
fact, the current 4.9 doesn't work well with Windows headers either
since it's not defining _INTPTR_T_DEFINED, etc. I don't think any of
the other types are defined by MSVC headers.
--
Matthew Leverton
#ifdef ALLEGRO_WINDOWS
#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef _W64 int intptr_t;
#endif
#define _INTPTR_T_DEFINED
#endif
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef _W64 unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#else
#define intptr_t int32_t
#define uintptr_t uint32_t
#endif