Skip to content

Instantly share code, notes, and snippets.

@rageandqq
Created February 28, 2018 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rageandqq/0837f7efb6d612d723f178ab886e5323 to your computer and use it in GitHub Desktop.
Save rageandqq/0837f7efb6d612d723f178ab886e5323 to your computer and use it in GitHub Desktop.
Operating System Specific Predefined Macros for GCC
// Taken from https://stackoverflow.com/a/5920028/3133680
#ifdef _WIN32
//define something for Windows (32-bit and 64-bit, this part is common)
#ifdef _WIN64
//define something for Windows (64-bit only)
#else
//define something for Windows (32-bit only)
#endif
#elif __APPLE__
#include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR
// iOS Simulator
#elif TARGET_OS_IPHONE
// iOS device
#elif TARGET_OS_MAC
// Other kinds of Mac OS
#else
# error "Unknown Apple platform"
#endif
#elif __linux__
// linux
#elif __unix__ // all unices not caught above
// Unix
#elif defined(_POSIX_VERSION)
// POSIX
#else
# error "Unknown compiler"
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment