Chess
0.0.1
A library written in c
Loading...
Searching...
No Matches
macros.h
Go to the documentation of this file.
1
8
#ifndef CHESS_MACROS_H_INCLUDED
9
#define CHESS_MACROS_H_INCLUDED
10
11
#if defined(__cplusplus) && defined(__cpp_constexpr)
12
#define CHESS_HAS_CONSTEXPR
13
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
14
#if defined(__clang__)
15
#if (__clang_major__ > 19) || (__clang_major__ == 19 && __clang_minor__ >= 1)
16
#define CHESS_HAS_CONSTEXPR
17
#endif
18
#else
19
#define CHESS_HAS_CONSTEXPR
20
#endif
21
#endif
22
23
#if defined(__cplusplus) && __cplusplus >= 201103L
24
#define CHESS_HAS_TYPED_ENUM
25
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
26
#define CHESS_HAS_TYPED_ENUM
27
#endif
28
29
#if defined(__cplusplus) && __cplusplus >= 201103L
30
#define CHESS_HAS_NULLPTR
31
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
32
#define CHESS_HAS_NULLPTR
33
#endif
34
40
#ifdef CHESS_HAS_CONSTEXPR
41
#define CHESS_CONSTEXPR constexpr
42
#else
43
#define CHESS_CONSTEXPR const
44
#endif
45
54
#ifdef CHESS_HAS_CONSTEXPR
55
#define CHESS_DEFINE_INTEGRAL_CONSTANT(type, name, value) \
56
static CHESS_CONSTEXPR type name = (value)
57
#else
58
#ifdef CHESS_HAS_TYPED_ENUM
59
#define CHESS_DEFINE_INTEGRAL_CONSTANT(type, name, value) \
60
enum : type { \
61
name = (value) \
62
}
63
#else
64
#define CHESS_DEFINE_INTEGRAL_CONSTANT(type, name, value) \
65
enum { \
66
name = (value) \
67
}
68
#endif
69
#endif
70
78
#ifdef CHESS_HAS_TYPED_ENUM
79
#define CHESS_ENUM(type, name) \
80
enum name : type; \
81
typedef enum name name; \
82
enum name : type
83
#else
84
#define CHESS_ENUM(type, name) \
85
typedef type name; \
86
enum name
87
#endif
88
94
#ifdef CHESS_HAS_NULLPTR
95
#define CHESS_NULL nullptr
96
#else
97
#define CHESS_NULL NULL
98
#endif
99
107
#define CHESS_ARRAY_LENGTH(array) (sizeof(array) / sizeof((array)[0]))
108
109
#endif
// CHESS_MACROS_H_INCLUDED
include
chess
macros.h
Generated by
1.9.8