XTE_ARCH

Defined in header <xte/preproc/arch.hpp>

Macros for detecting the current architecture. Definitions are compiler-dependent and not mutually exclusive.

Replace NAME with one of: AARCH32, AARCH64, ALPHA, AM29000, ATMEL_AVR, BLACKFIN, COMPACTRISC, CONVEX, CRAY, CRAY_T3D, CRAY_T3E, CSKY, D10V, D30V, EPIPHANY, ELBRUS_2000, FUJITSU_FR_V, FR30, FT32, H8300, HEXAGON, HP_800, HP_9000, I960, IA64, IBM_SYSTEM_32, IBM_SYSTEM_370, IBM_SYSTEM_390, IBM_Z, IP2000, IQ2000, LATTICEMICO32, LOONGARCH, M_CORE, M32C, M32R, MIPS, MMIX, MN10200, MN10300, MOTOROLA_68000, MOTOROLA_88000, MOTOROLA_HC11, MOTOROLA_M_CORE, MOXIE, MSP430, NDS32, NEC_SX_AURORA_TSUBASA, NIOS_II, OPENRISC, PA_RISC, PDP_11, PNACL, POWERPC, PTX, PYRAMID_9810, RENESAS_RX, RISC_V, RL78, RS_6000, SPARC, SUPERH, SYNOPSYS_ARC, TAHOE, TIC_80, TILERA_TILEPRO64, TILERA_TILE_GX, TMS320, TMS470, V850, VAX, WASM, WDC_65C02, X80, X86_32, X86_64, XENON, XSTORMY16, XTENSA, ZILOG_Z8000.


Definitions

#arch
#define XTE_ARCH_NAME /* boolean integer literal */
Detects the presence of an architecture.

#major
#define XTE_ARCH_NAME_MAJOR /* integer literal */
Detects the major version of an architecture.

#minor
#define XTE_ARCH_NAME_MINOR /* integer literal */
Detects the minor version of an architecture.

#patch
#define XTE_ARCH_NAME_PATCH /* integer literal */
Detects the patch version of an architecture.

#version
#define XTE_ARCH(NAME, OP, MAJOR, /* MINOR, PATCH */...) /* boolean expression */
OP must be <, <=, >, >=, ==, or !=. Allows up to two additional arguments for the minor and patch versions. Expands to an expression comparing an architecture's version to the provided arguments.



Example

#if XTE_ARCH_X86_64
	yup
#else
	nop
#endif
Possible preprocessor output:
yup
[View in Compiler Explorer]