XTE_LANG

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

Macros for detecting the current language. Definitions are compiler-dependent and might not be mutually exclusive.

Replace NAME with one of: C, CPP, CPP_CLI, CPP_CX, CPP_EMBEDDED, CPP_WINRT, CUDA, GLSL, HLSL, METAL, OBJ_C, OBJ_CPP, PSSL.


Definitions

#lang
#define XTE_LANG_NAME /* boolean integer literal */
Detects the presence of an language.

#major
#define XTE_LANG_NAME_MAJOR /* integer literal */
Detects the major version of a language.

#minor
#define XTE_LANG_NAME_MINOR /* integer literal */
Detects the minor version of a language.

#patch
#define XTE_LANG_NAME_PATCH /* integer literal */
Detects the patch version of a language.

#version
#define XTE_LANG(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 a language's version to the provided arguments.



Example

#if XTE_LANG(CPP, >=, 2026)
	yup
#else
	nop
#endif
Possible preprocessor output:
yup
[View in Compiler Explorer]