JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
Loading...
Searching...
No Matches
platform.h File Reference

Base platform checks and macros for all modules. More...

#include <cstddef>

Go to the source code of this file.

Macros

#define IS_CLANG   0
#define IS_GCC   0
#define JH_GCC_VERSION   0
#define JH_GCC_LE_13   (IS_GCC && JH_GCC_VERSION < 140000)
#define IS_MSVC   0
#define IS_POSIX   0
#define HAS_POSIX_1B   0
#define IS_AMD64   0
#define IS_X86   0
#define IS_AARCH64   0
#define IS_X86_FAMILY   (IS_X86 || IS_AMD64)
#define IS_WINDOWS   0
#define IS_MINGW   0
#define IS_CLANG_ON_WINDOWS   0
#define IS_LINUX   0
#define IS_APPLE   0
#define IS_DARWIN   IS_APPLE
#define IS_FREEBSD   0
#define IS_OS_X   0
#define IS_MACOS   IS_OS_X
#define IS_WASM   0
#define IS_BIG_ENDIAN   0
#define IS_LITTLE_ENDIAN   (!IS_BIG_ENDIAN)

Detailed Description

Base platform checks and macros for all modules.

Author
JeongHan-Bae <mastropseudo@gmail.com>

Enforces 64-bit targets and excludes unsupported compilers (MSVC). Provides compiler, architecture, OS, and endianness detection macros.

This header is implicitly included in most internal components to guard against undefined behavior on unsupported platforms or toolchains.

Macros > constexpr: better and leaner for compilation and branch optimization.

Macro Design Philosophy

This header defines a minimal and precise set of IS_* macros to identify platform, compiler, architecture, and endianness traits.

  • Purely semantic (e.g., IS_LINUX == 1 means target is Linux)
  • Zero-side-effect (no redefinitions, no overrides)
  • Safe for co-existence (as long as the same macro has the same meaning)
Note

These macros are intentionally simple:

  • No namespace pollution
  • No extra logic or branching
  • No dependency on other libraries


This avoids undefined behavior even when included alongside other headers or libraries that define the same macros consistently.
Rule: If another library defines the same IS_XXX macro with the same meaning, it's harmless.