Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » So many preprocessor defines for platform !
So many preprocessor defines for platform ! [message #39620] |
Tue, 09 April 2013 14:56 |
|
jibe
Messages: 294 Registered: February 2007 Location: France
|
Experienced Member |
|
|
Hi,
Trying (for the first time) to develop something for various platforms, I get very confused about what to use to have platform specific parts of code.
Those preprocessor directives can be found (maybe more... I just grep'ed the upp folder) :
#ifdef BSD
#ifdef POSIX
#ifdef SOLARIS
#ifdef WIN32
#ifdef WIN64
#ifdef WINDOWS
#ifdef WINVER
#ifdef WIN_SHM_BASE
#ifdef flagPOSIX
#ifdef PLATFORM_BSD
#ifdef PLATFORM_FREEBSD
#ifdef PLATFORM_LINUX
#ifdef PLATFORM_OSX11
#ifdef PLATFORM_POSIX
#ifdef PLATFORM_SOLARIS
#ifdef PLATFORM_WIN32
#ifdef PLATFORM_WINCE
#ifdef PLATFORM_X11
#ifdef _WIN32
#ifdef _WIN32_WCE
#ifdef _WIN32_WINNT
#ifdef _WIN64
#ifdef _WINDOWS
#ifdef __WIN32__
#ifdef __WIN64__
#ifdef __linux__
Could somebody explain (or point to some doc or explanation) why so many, what are the differences and which one must be used in which case ?
ie : how do I choose between #ifdef WIN32, #ifdef PLATFORM_WIN32, #ifdef _WIN32 or #ifdef __WIN32__ ?
And when I #define one of them, are the others automatically defined or undefined ? That is, if I #define PLATFORM_LINUX, will be __linux__, POSIX, flagPOSIX and PLATFORM_POSIX defined, and all ones regarding WINDOWS, OSX, BSD etc. undefined ?
|
|
|
Goto Forum:
Current Time: Wed Apr 24 22:29:15 CEST 2024
Total time taken to generate the page: 0.02450 seconds
|