XIEITE_PLATFORM_TYPE_/*???*/, XIEITE_PLATFORM_MAJOR_/*???*/, XIEITE_PLATFORM_MINOR_/*???*/, XIEITE_PLATFORM_PATCH_/*???*/, XIEITE_PLATFORM_EQ(), XIEITE_PLATFORM_LEAST(), XIEITE_PLATFORM_MOST()

Defined in header <xieite/pp/platform.hpp>

Macros for identifying the current platform or operating system and its version (major, minor, patch).
The macros are not mutually exclusive due to some being related to others (e.g. an Android platform is also a Linux platform).


Definitions

#type
#define XIEITE_PLATFORM_TYPE_/*???*/ /* boolean integer literal */
#define XIEITE_PLATFORM_MAJOR_/*???*/ /* integer literal */
#define XIEITE_PLATFORM_MINOR_/*???*/ /* integer literal */
#define XIEITE_PLATFORM_PATCH_/*???*/ /* integer literal */
Use with AEGIS, AIX, AKAROS, AMIGAOS, ANDROID, APPLE_II, APPLE_IIE, ASMJS, ATARI, ATARI_2600, ATARI_5200, ATARI_LYNX, ATARI_XL, BEOS, BLUE_GENE, BSD, BSD_BSDI, BSD_DRAGONFLY, BSD_FREE, BSD_NET, BSD_OPEN, CLOUDABI, CMB, CMB_500, CMB_600, COMMANDER_X16, COMMODORE_16, COMMODORE_64, COMMODORE_128, COMMODORE_PLUS_4, COMMODORE_VIC20, CONVEXOS, CYGWIN, DC_OSX, DG_UX, DOMAIN_OS, DRAGONFLY, DYNIX, ECOS, EMX, FREEBSD, FUCHSIA, GEOS, GEOS_APPLE, GEOS_CMB, GNU_HURD, GNU_KFREEBSD, GNU_LINUX, HAIKU, HI_UX_MPP, HP_UX, INTEGRITY, INTERIX, IOS_SIMULATOR, IRIX, KALLISTI, LINUX, LUNIX, LYNXOS, MACINTOSH, MACINTOSH_DYLD, MINGW32, MINGW64, MINIX, MORPHOS, MPE_IX, MS_DOS, NACL, NES, NEXT, NINTENDO_3DS, NINTENDO_GAMECUBE, NINTENDO_SWITCH, NONSTOP, NUCLEUS_RTOS, OHIO_SCIENTIFIC_CHALLENGER_1P, OPENSERVER, ORIC_ATMOS, OS_2, OS_400, OS_9, PALM_OS, PDOS, PET, PHOENIX, PLAN_9, PNACL, QNX, SEGA_DREAMCAST, SIM6502, SIM65C02, SINIX, SOLARIS, SONY_PLAYSTATION, SONY_PLAYSTATION_2, SONY_PLAYSTATION_3, SONY_PLAYSTATION_4, SONY_PLAYSTATION_5, SONY_PLAYSTATION_P, SONY_VITA, SUPERVISION, SYGWIN, SYLLABLE, SYM1, SYMBIAN, SYSTEM_V, TELESTRAT, TRU64, UCLINUX, ULTRIX, UNICOS, UNICOS_MP, UNIX, UNIXWARE, UTS, UWIN, VMS, VOS, VXWORKS, WINDOWS, WINDOWS_CE, WINDOWS_DESKTOP, WINDOWS_GDK, WINDOWS_NT, WIND_U, XBOX, XBOX_360, XBOX_ONE, XBOX_SERIES, or Z. See example.

#eq
#define XIEITE_PLATFORM_EQ(type, major, .../* minor, patch */) /* boolean expression */
Allows two optional arguments for the minor and patch version numbers. Expands to an expression checking whether a platform is the target platform and its version is equal to some value.

#least
#define XIEITE_PLATFORM_LEAST(type, major, .../* minor, patch */) /* boolean expression */
Expands to an expression checking whether a platform is the target platform and its version is equal to or greater than some value.

#most
#define XIEITE_PLATFORM_MOST(type, major, .../* minor, patch */) /* boolean expression */
Expands to an expression checking whether a platform is the target platform and its version is equal to or less than some value.


Example

int main() {
	std::print("Is target platform Linux? {}\n", XIEITE_PLATFORM_TYPE_LINUX);
}
Possible output:
Is target platform Linux? 1
[View in Compiler Explorer]