Last active
May 29, 2018 01:58
-
-
Save j2doll/c1a0967c7e46f684f29feb5ab5f513f7 to your computer and use it in GitHub Desktop.
Determining 32 vs 64 bit in C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// which32-64.cpp | |
// check 32/64bit for Microsoft Visual C++(Visual Studio) (or, C++ Builer, etc) | |
#if ((ULONG_MAX) == (UINT_MAX)) | |
# define IS32BIT // 32bit Windows(x32) | |
#else | |
# define IS64BIT // 64bit Windows(x64) | |
#endif | |
// check 32/64bit for gcc(g++) | |
#if __GNUC__ | |
#if __x86_64__ || __ppc64__ | |
#define ENVIRONMENT64 // 64bit OS | |
#else | |
#define ENVIRONMENT32 // 32bit OS | |
#endif | |
#endif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment