Rihen Rihen NkentseuDocumentation
Development version, not published. Built from main: it shows what is coming (fixes, descriptions written since the last tag) and can change with every commit. Go to the stable version 0.1.0-beta.11

NkCompilerDetect.h

Include
#include "NKPlatform/NkCompilerDetect.h"
Link (Jenga)
nkentseudependson(["NKPlatform"])

Aliases · 2

NKENTSEU_int128Signed 128-bit integer type
NKENTSEU_uint128Unsigned 128-bit integer type

Macros · 94

NKENTSEU_COMPILER_MSVCDetection macro for MSVC (Microsoft Visual C++)
NKENTSEU_COMPILER_VERSIONNumeric compiler version
NKENTSEU_COMPILER_MSVC_2024MSVC 2024 or later (VS 17.10+)
NKENTSEU_COMPILER_MSVC_2022MSVC 2022 or later (VS 17.0+)
NKENTSEU_COMPILER_MSVC_2019MSVC 2019 or later (VS 16.0+)
NKENTSEU_COMPILER_MSVC_2017MSVC 2017 or later (VS 15.0+)
NKENTSEU_COMPILER_CLANGDetection of the Clang (LLVM) compiler
NKENTSEU_COMPILER_APPLE_CLANGDetection of Apple Clang
NKENTSEU_COMPILER_GCCDetection of the GCC compiler
NKENTSEU_COMPILER_INTELDetection of the Intel C++ compiler
NKENTSEU_COMPILER_EMSCRIPTENDetection of the Emscripten compiler
NKENTSEU_COMPILER_NVCCDetection of the NVCC (CUDA) compiler
NKENTSEU_COMPILER_SUNPRODetection of the SunPro/Oracle compiler
NKENTSEU_COMPILER_XLCDetection of the IBM XL C/C++ compiler
NKENTSEU_CPP23C++23 standard or later
NKENTSEU_CPP_VERSIONThe C++ standard version being compiled, as a number (23, 20, 17...).
NKENTSEU_CPP20C++20 standard or later
NKENTSEU_CPP17C++17 standard or later
NKENTSEU_CPP14C++14 standard or later
NKENTSEU_CPP11C++11 standard or later
NKENTSEU_CPP98C++98/C++03 standard
NKENTSEU_HAS_CPP11General C++11 support
NKENTSEU_HAS_NULLPTRSupport for the nullptr keyword
NKENTSEU_HAS_AUTOSupport for the auto keyword for type inference
NKENTSEU_HAS_DECLTYPESupport for decltype for type inspection
NKENTSEU_HAS_RVALUE_REFERENCESSupport for rvalue references and move semantics
NKENTSEU_HAS_VARIADIC_TEMPLATESSupport for variadic templates
NKENTSEU_HAS_STATIC_ASSERTSupport for static_assert for compile-time assertions
NKENTSEU_HAS_CONSTEXPRSupport for constexpr for compile-time evaluation
NKENTSEU_HAS_NOEXCEPTSupport for noexcept to state that no exception is thrown
NKENTSEU_HAS_OVERRIDESupport for the override specifier on virtual methods
NKENTSEU_HAS_FINALSupport for the final specifier to prevent inheritance
NKENTSEU_HAS_DEFAULT_DELETESupport for default/delete functions
NKENTSEU_HAS_LAMBDASupport for lambda expressions
NKENTSEU_HAS_RANGE_FORSupport for range-based for loops
NK_CPP11Historical alias of NKENTSEU_HAS_CPP11, used by the NKContainers guards (#if defined(NK_CPP11): move, forwarding, noexcept).
NKENTSEU_HAS_CPP14General C++14 support
NKENTSEU_HAS_GENERIC_LAMBDASSupport for generic lambdas (auto parameters)
NKENTSEU_HAS_VARIABLE_TEMPLATESSupport for variable templates
NKENTSEU_HAS_RELAXED_CONSTEXPRSupport for relaxed constexpr (more expressions allowed)
NKENTSEU_HAS_BINARY_LITERALSSupport for binary literals (0b1010)
NKENTSEU_HAS_DECLTYPE_AUTOSupport for decltype(auto) for perfect type inference
NKENTSEU_HAS_CPP17General C++17 support
NKENTSEU_HAS_INLINE_VARIABLESSupport for inline variables (definition in headers)
NKENTSEU_HAS_FOLD_EXPRESSIONSSupport for fold expressions on variadic templates
NKENTSEU_HAS_IF_CONSTEXPRSupport for if constexpr for conditional compilation
NKENTSEU_HAS_STRUCTURED_BINDINGSSupport for structured bindings to decompose tuples/structs
NKENTSEU_HAS_CONSTEXPR_IFAlias for NKENTSEU_HAS_IF_CONSTEXPR (naming consistency)
NKENTSEU_HAS_NODISCARDSupport for the [[nodiscard]] attribute
NKENTSEU_HAS_MAYBE_UNUSEDSupport for the [[maybe_unused]] attribute
NKENTSEU_HAS_FALLTHROUGHSupport for the [[fallthrough]] attribute in switches
NKENTSEU_HAS_CPP20General C++20 support
NKENTSEU_HAS_CONCEPTSSupport for concepts to constrain templates
NKENTSEU_HAS_MODULESSupport for modules for modular compilation
NKENTSEU_HAS_COROUTINESSupport for coroutines for asynchronous programming
NKENTSEU_HAS_CONSTEXPR_VIRTUALSupport for constexpr on virtual functions
NKENTSEU_HAS_CONSTEVALSupport for consteval for immediate compile-time evaluation
NKENTSEU_HAS_CONSTINITSupport for constinit for guaranteed static initialisation
NKENTSEU_HAS_THREE_WAY_COMPARISONSupport for the three-way comparison operator (<=>)
NKENTSEU_HAS_DESIGNATED_INITIALIZERSSupport for designated initializers
NKENTSEU_HAS_CPP23General C++23 support
NKENTSEU_HAS_DEDUCING_THISSupport for 'deducing this' for explicit object methods
NKENTSEU_HAS_IF_CONSTEVALSupport for if consteval to detect constant evaluation
NKENTSEU_HAS_MULTIDIMENSIONAL_SUBSCRIPTSupport for multidimensional subscripts (obj[1, 2, 3])
NKENTSEU_CONSTEXPRPortable macro for constexpr
NKENTSEU_NOEXCEPTPortable macro for noexcept
NKENTSEU_NOEXCEPT_IFMacro for conditional noexcept
NKENTSEU_OVERRIDEPortable macro for override
NKENTSEU_FINALPortable macro for final
NKENTSEU_NODISCARDPortable macro for [[nodiscard]]
NKENTSEU_NODISCARD_MSG[[nodiscard]] with a custom message
NKENTSEU_NODISCARD_SIMPLESimple alias for [[nodiscard]]
NKENTSEU_MAYBE_UNUSEDPortable macro for [[maybe_unused]]
NKENTSEU_FALLTHROUGHPortable macro for [[fallthrough]]
NKENTSEU_PACKEDPacked structure (no memory padding)
NKENTSEU_PACK_BEGINStart of a packed block with push/pop
NKENTSEU_PACK_ENDEnd of a packed block
NKENTSEU_RESTRICTrestrict keyword for pointers without aliasing
NKENTSEU_THREAD_LOCALThread-local storage (one variable per thread)
NKENTSEU_DEPRECATEDdeprecated attribute with an optional message
NKENTSEU_DEPRECATED_MSGdeprecated attribute with a custom message
NKENTSEU_FUNCTION_NAMEDecorated name of the current function (with its full signature)
NKENTSEU_FILE_NAMEPath of the current source file
NKENTSEU_LINE_NUMBERCurrent source line number
NKENTSEU_HAS_RTTIRTTI (Run-Time Type Information) support
NKENTSEU_HAS_EXCEPTIONSC++ exceptions support
NKENTSEU_HAS_INT128128-bit integer support (__int128)
NKENTSEU_PRAGMAMacro to emit a pragma portably
NKENTSEU_DISABLE_WARNING_PUSHSaves the current warning state (push)
NKENTSEU_DISABLE_WARNING_POPRestores the warning state after a push (pop)
NKENTSEU_DISABLE_WARNINGDisables a specific warning
NKENTSEU_DISABLE_WARNING_MSVCDisables an MSVC warning; does nothing with another compiler.
NKENTSEU_DISABLE_WARNING_CLANGDisables a Clang warning; does nothing with another compiler.
NKENTSEU_DISABLE_WARNING_GCCDisables a GCC warning; does nothing with another compiler.

Member details

NKENTSEU_COMPILER_MSVC

#
macro
#define NKENTSEU_COMPILER_MSVC

Detection macro for MSVC (Microsoft Visual C++)

@codefragment, not compiled
#ifdef NKENTSEU_COMPILER_MSVC
    // Code spécifique à MSVC
    #pragma warning(disable: 4100)
#endif

NKENTSEU_COMPILER_VERSION

#
macro
#define NKENTSEU_COMPILER_VERSION

Numeric compiler version

NKENTSEU_COMPILER_MSVC_2024

#
macro
#define NKENTSEU_COMPILER_MSVC_2024

MSVC 2024 or later (VS 17.10+)

NKENTSEU_COMPILER_MSVC_2022

#
macro
#define NKENTSEU_COMPILER_MSVC_2022

MSVC 2022 or later (VS 17.0+)

NKENTSEU_COMPILER_MSVC_2019

#
macro
#define NKENTSEU_COMPILER_MSVC_2019

MSVC 2019 or later (VS 16.0+)

NKENTSEU_COMPILER_MSVC_2017

#
macro
#define NKENTSEU_COMPILER_MSVC_2017

MSVC 2017 or later (VS 15.0+)

NKENTSEU_COMPILER_CLANG

#
macro
#define NKENTSEU_COMPILER_CLANG

Detection of the Clang (LLVM) compiler

NKENTSEU_COMPILER_APPLE_CLANG

#
macro
#define NKENTSEU_COMPILER_APPLE_CLANG

Detection of Apple Clang

NKENTSEU_COMPILER_GCC

#
macro
#define NKENTSEU_COMPILER_GCC

Detection of the GCC compiler

NKENTSEU_COMPILER_INTEL

#
macro
#define NKENTSEU_COMPILER_INTEL

Detection of the Intel C++ compiler

NKENTSEU_COMPILER_EMSCRIPTEN

#
macro
#define NKENTSEU_COMPILER_EMSCRIPTEN

Detection of the Emscripten compiler

NKENTSEU_COMPILER_NVCC

#
macro
#define NKENTSEU_COMPILER_NVCC

Detection of the NVCC (CUDA) compiler

NKENTSEU_COMPILER_SUNPRO

#
macro
#define NKENTSEU_COMPILER_SUNPRO

Detection of the SunPro/Oracle compiler

NKENTSEU_COMPILER_XLC

#
macro
#define NKENTSEU_COMPILER_XLC

Detection of the IBM XL C/C++ compiler

NKENTSEU_CPP23

#
macro
#define NKENTSEU_CPP23

C++23 standard or later

NKENTSEU_CPP_VERSION

#
macro
#define NKENTSEU_CPP_VERSION

The C++ standard version being compiled, as a number (23, 20, 17...).

NKENTSEU_CPP20

#
macro
#define NKENTSEU_CPP20

C++20 standard or later

NKENTSEU_CPP17

#
macro
#define NKENTSEU_CPP17

C++17 standard or later

NKENTSEU_CPP14

#
macro
#define NKENTSEU_CPP14

C++14 standard or later

NKENTSEU_CPP11

#
macro
#define NKENTSEU_CPP11

C++11 standard or later

NKENTSEU_CPP98

#
macro
#define NKENTSEU_CPP98

C++98/C++03 standard

NKENTSEU_HAS_CPP11

#
macro
#define NKENTSEU_HAS_CPP11

General C++11 support

NKENTSEU_HAS_NULLPTR

#
macro
#define NKENTSEU_HAS_NULLPTR

Support for the nullptr keyword

NKENTSEU_HAS_AUTO

#
macro
#define NKENTSEU_HAS_AUTO

Support for the auto keyword for type inference

NKENTSEU_HAS_DECLTYPE

#
macro
#define NKENTSEU_HAS_DECLTYPE

Support for decltype for type inspection

NKENTSEU_HAS_RVALUE_REFERENCES

#
macro
#define NKENTSEU_HAS_RVALUE_REFERENCES

Support for rvalue references and move semantics

NKENTSEU_HAS_VARIADIC_TEMPLATES

#
macro
#define NKENTSEU_HAS_VARIADIC_TEMPLATES

Support for variadic templates

NKENTSEU_HAS_STATIC_ASSERT

#
macro
#define NKENTSEU_HAS_STATIC_ASSERT

Support for static_assert for compile-time assertions

NKENTSEU_HAS_CONSTEXPR

#
macro
#define NKENTSEU_HAS_CONSTEXPR

Support for constexpr for compile-time evaluation

NKENTSEU_HAS_NOEXCEPT

#
macro
#define NKENTSEU_HAS_NOEXCEPT

Support for noexcept to state that no exception is thrown

NKENTSEU_HAS_OVERRIDE

#
macro
#define NKENTSEU_HAS_OVERRIDE

Support for the override specifier on virtual methods

NKENTSEU_HAS_FINAL

#
macro
#define NKENTSEU_HAS_FINAL

Support for the final specifier to prevent inheritance

NKENTSEU_HAS_DEFAULT_DELETE

#
macro
#define NKENTSEU_HAS_DEFAULT_DELETE

Support for default/delete functions

NKENTSEU_HAS_LAMBDA

#
macro
#define NKENTSEU_HAS_LAMBDA

Support for lambda expressions

NKENTSEU_HAS_RANGE_FOR

#
macro
#define NKENTSEU_HAS_RANGE_FOR

Support for range-based for loops

NK_CPP11

#
macro
#define NK_CPP11

Historical alias of NKENTSEU_HAS_CPP11, used by the NKContainers guards (#if defined(NK_CPP11): move, forwarding, noexcept).

NKENTSEU_HAS_CPP14

#
macro
#define NKENTSEU_HAS_CPP14

General C++14 support

NKENTSEU_HAS_GENERIC_LAMBDAS

#
macro
#define NKENTSEU_HAS_GENERIC_LAMBDAS

Support for generic lambdas (auto parameters)

NKENTSEU_HAS_VARIABLE_TEMPLATES

#
macro
#define NKENTSEU_HAS_VARIABLE_TEMPLATES

Support for variable templates

NKENTSEU_HAS_RELAXED_CONSTEXPR

#
macro
#define NKENTSEU_HAS_RELAXED_CONSTEXPR

Support for relaxed constexpr (more expressions allowed)

NKENTSEU_HAS_BINARY_LITERALS

#
macro
#define NKENTSEU_HAS_BINARY_LITERALS

Support for binary literals (0b1010)

NKENTSEU_HAS_DECLTYPE_AUTO

#
macro
#define NKENTSEU_HAS_DECLTYPE_AUTO

Support for decltype(auto) for perfect type inference

NKENTSEU_HAS_CPP17

#
macro
#define NKENTSEU_HAS_CPP17

General C++17 support

NKENTSEU_HAS_INLINE_VARIABLES

#
macro
#define NKENTSEU_HAS_INLINE_VARIABLES

Support for inline variables (definition in headers)

NKENTSEU_HAS_FOLD_EXPRESSIONS

#
macro
#define NKENTSEU_HAS_FOLD_EXPRESSIONS

Support for fold expressions on variadic templates

NKENTSEU_HAS_IF_CONSTEXPR

#
macro
#define NKENTSEU_HAS_IF_CONSTEXPR

Support for if constexpr for conditional compilation

NKENTSEU_HAS_STRUCTURED_BINDINGS

#
macro
#define NKENTSEU_HAS_STRUCTURED_BINDINGS

Support for structured bindings to decompose tuples/structs

NKENTSEU_HAS_CONSTEXPR_IF

#
macro
#define NKENTSEU_HAS_CONSTEXPR_IF

Alias for NKENTSEU_HAS_IF_CONSTEXPR (naming consistency)

NKENTSEU_HAS_NODISCARD

#
macro
#define NKENTSEU_HAS_NODISCARD

Support for the [[nodiscard]] attribute

NKENTSEU_HAS_MAYBE_UNUSED

#
macro
#define NKENTSEU_HAS_MAYBE_UNUSED

Support for the [[maybe_unused]] attribute

NKENTSEU_HAS_FALLTHROUGH

#
macro
#define NKENTSEU_HAS_FALLTHROUGH

Support for the [[fallthrough]] attribute in switches

NKENTSEU_HAS_CPP20

#
macro
#define NKENTSEU_HAS_CPP20

General C++20 support

NKENTSEU_HAS_CONCEPTS

#
macro
#define NKENTSEU_HAS_CONCEPTS

Support for concepts to constrain templates

NKENTSEU_HAS_MODULES

#
macro
#define NKENTSEU_HAS_MODULES

Support for modules for modular compilation

NKENTSEU_HAS_COROUTINES

#
macro
#define NKENTSEU_HAS_COROUTINES

Support for coroutines for asynchronous programming

NKENTSEU_HAS_CONSTEXPR_VIRTUAL

#
macro
#define NKENTSEU_HAS_CONSTEXPR_VIRTUAL

Support for constexpr on virtual functions

NKENTSEU_HAS_CONSTEVAL

#
macro
#define NKENTSEU_HAS_CONSTEVAL

Support for consteval for immediate compile-time evaluation

NKENTSEU_HAS_CONSTINIT

#
macro
#define NKENTSEU_HAS_CONSTINIT

Support for constinit for guaranteed static initialisation

NKENTSEU_HAS_THREE_WAY_COMPARISON

#
macro
#define NKENTSEU_HAS_THREE_WAY_COMPARISON

Support for the three-way comparison operator (<=>)

NKENTSEU_HAS_DESIGNATED_INITIALIZERS

#
macro
#define NKENTSEU_HAS_DESIGNATED_INITIALIZERS

Support for designated initializers

NKENTSEU_HAS_CPP23

#
macro
#define NKENTSEU_HAS_CPP23

General C++23 support

NKENTSEU_HAS_DEDUCING_THIS

#
macro
#define NKENTSEU_HAS_DEDUCING_THIS

Support for 'deducing this' for explicit object methods

NKENTSEU_HAS_IF_CONSTEVAL

#
macro
#define NKENTSEU_HAS_IF_CONSTEVAL

Support for if consteval to detect constant evaluation

NKENTSEU_HAS_MULTIDIMENSIONAL_SUBSCRIPT

#
macro
#define NKENTSEU_HAS_MULTIDIMENSIONAL_SUBSCRIPT

Support for multidimensional subscripts (obj[1, 2, 3])

NKENTSEU_CONSTEXPR

#
macro
#define NKENTSEU_CONSTEXPR

Portable macro for constexpr

@codefragment, not compiled
NKENTSEU_CONSTEXPR int Square(int x) { return x * x; }

NKENTSEU_NOEXCEPT

#
macro
#define NKENTSEU_NOEXCEPT

Portable macro for noexcept

NKENTSEU_NOEXCEPT_IF

#
macro
#define NKENTSEU_NOEXCEPT_IF(condition)

Macro for conditional noexcept

NKENTSEU_OVERRIDE

#
macro
#define NKENTSEU_OVERRIDE

Portable macro for override

NKENTSEU_FINAL

#
macro
#define NKENTSEU_FINAL

Portable macro for final

NKENTSEU_NODISCARD

#
macro
#define NKENTSEU_NODISCARD

Portable macro for [[nodiscard]]

NKENTSEU_NODISCARD_MSG

#
macro
#define NKENTSEU_NODISCARD_MSG(msg)

[[nodiscard]] with a custom message

NKENTSEU_NODISCARD_SIMPLE

#
macro
#define NKENTSEU_NODISCARD_SIMPLE

Simple alias for [[nodiscard]]

NKENTSEU_MAYBE_UNUSED

#
macro
#define NKENTSEU_MAYBE_UNUSED

Portable macro for [[maybe_unused]]

NKENTSEU_FALLTHROUGH

#
macro
#define NKENTSEU_FALLTHROUGH

Portable macro for [[fallthrough]]

NKENTSEU_PACKED

#
macro
#define NKENTSEU_PACKED

Packed structure (no memory padding)

@codefragment, not compiled
struct NKENTSEU_PACKED NetworkHeader {
    uint16_t type;
    uint32_t length;
    // Pas de padding entre type et length
};

NKENTSEU_PACK_BEGIN

#
macro
#define NKENTSEU_PACK_BEGIN

Start of a packed block with push/pop

NKENTSEU_PACK_END

#
macro
#define NKENTSEU_PACK_END

End of a packed block

NKENTSEU_RESTRICT

#
macro
#define NKENTSEU_RESTRICT

restrict keyword for pointers without aliasing

@codefragment, not compiled
void CopyBuffer(
    float* NKENTSEU_RESTRICT dest,
    const float* NKENTSEU_RESTRICT src,
    size_t count
);

NKENTSEU_THREAD_LOCAL

#
macro
#define NKENTSEU_THREAD_LOCAL

Thread-local storage (one variable per thread)

@codefragment, not compiled
NKENTSEU_THREAD_LOCAL int g_ThreadLocalCounter = 0;

NKENTSEU_DEPRECATED

#
macro
#define NKENTSEU_DEPRECATED

deprecated attribute with an optional message

NKENTSEU_DEPRECATED_MSG

#
macro
#define NKENTSEU_DEPRECATED_MSG(msg)

deprecated attribute with a custom message

@codefragment, not compiled
NKENTSEU_DEPRECATED_MSG("Utiliser NewFunction() à la place")
void OldFunction();

NKENTSEU_FUNCTION_NAME

#
macro
#define NKENTSEU_FUNCTION_NAME

Decorated name of the current function (with its full signature)

@codefragment, not compiled
void DebugLog(const char* msg) {
    printf("[%s] %s\n", NKENTSEU_FUNCTION_NAME, msg);
}

NKENTSEU_FILE_NAME

#
macro
#define NKENTSEU_FILE_NAME

Path of the current source file

NKENTSEU_LINE_NUMBER

#
macro
#define NKENTSEU_LINE_NUMBER

Current source line number

NKENTSEU_HAS_RTTI

#
macro
#define NKENTSEU_HAS_RTTI

RTTI (Run-Time Type Information) support

NKENTSEU_HAS_EXCEPTIONS

#
macro
#define NKENTSEU_HAS_EXCEPTIONS

C++ exceptions support

NKENTSEU_HAS_INT128

#
macro
#define NKENTSEU_HAS_INT128

128-bit integer support (__int128)

NKENTSEU_int128

#
alias
typedef __int128 NKENTSEU_int128

Signed 128-bit integer type

NKENTSEU_uint128

#
alias
typedef unsigned __int128 NKENTSEU_uint128

Unsigned 128-bit integer type

NKENTSEU_PRAGMA

#
macro
#define NKENTSEU_PRAGMA(x)

Macro to emit a pragma portably

@codefragment, not compiled
NKENTSEU_PRAGMA(optimize("O3"))  // GCC/Clang
NKENTSEU_PRAGMA(warning(disable: 4100))  // MSVC

NKENTSEU_DISABLE_WARNING_PUSH

#
macro
#define NKENTSEU_DISABLE_WARNING_PUSH

Saves the current warning state (push)

NKENTSEU_DISABLE_WARNING_POP

#
macro
#define NKENTSEU_DISABLE_WARNING_POP

Restores the warning state after a push (pop)

NKENTSEU_DISABLE_WARNING

#
macro
#define NKENTSEU_DISABLE_WARNING(warningNumber)

Disables a specific warning

@codefragment, not compiled
// MSVC : désactiver warning 4100 (paramètre unused)
NKENTSEU_DISABLE_WARNING_PUSH
NKENTSEU_DISABLE_WARNING(4100)
void Func(int unused) { }
NKENTSEU_DISABLE_WARNING_POP

// GCC/Clang : désactiver warning "-Wunused-parameter"
NKENTSEU_DISABLE_WARNING_PUSH
NKENTSEU_DISABLE_WARNING("-Wunused-parameter")
void Func(int unused) { }
NKENTSEU_DISABLE_WARNING_POP

NKENTSEU_DISABLE_WARNING_MSVC

#
macro
#define NKENTSEU_DISABLE_WARNING_MSVC(x)

Disables an MSVC warning; does nothing with another compiler.

NKENTSEU_DISABLE_WARNING_CLANG

#
macro
#define NKENTSEU_DISABLE_WARNING_CLANG(x)

Disables a Clang warning; does nothing with another compiler.

NKENTSEU_DISABLE_WARNING_GCC

#
macro
#define NKENTSEU_DISABLE_WARNING_GCC(x)

Disables a GCC warning; does nothing with another compiler.