Chess 0.0.1
A library written in c
Loading...
Searching...
No Matches
macros.h File Reference

Defines macros and constants for the library. More...

Go to the source code of this file.

Macros

#define CHESS_CONSTEXPR   const
 Expands to constexpr if available, otherwise to const.
 
#define CHESS_DEFINE_INTEGRAL_CONSTANT(type, name, value)
 Defines a compile time integral constant.
 
#define CHESS_ENUM(type, name)
 Defines a typed enum or a typedef enum based on the availability of typed enums in the compiler.
 
#define CHESS_NULL   NULL
 Expands to nullptr if available, otherwise to NULL.
 
#define CHESS_ARRAY_LENGTH(array)   (sizeof(array) / sizeof((array)[0]))
 Computes the length of the given array.
 

Detailed Description

Defines macros and constants for the library.

Author
Tarek Saeed
Date
2025-06-14

Macro Definition Documentation

◆ CHESS_ARRAY_LENGTH

#define CHESS_ARRAY_LENGTH (   array)    (sizeof(array) / sizeof((array)[0]))

Computes the length of the given array.

Parameters
[in]arrayThe array
Returns
The length of the array

◆ CHESS_DEFINE_INTEGRAL_CONSTANT

#define CHESS_DEFINE_INTEGRAL_CONSTANT (   type,
  name,
  value 
)
Value:
enum { \
name = (value) \
}

Defines a compile time integral constant.

Parameters
[in]typeThe type of the constant.
[in]nameThe name of the constant.
[in]valueThe value of the constant.

◆ CHESS_ENUM

#define CHESS_ENUM (   type,
  name 
)
Value:
typedef type name; \
enum name

Defines a typed enum or a typedef enum based on the availability of typed enums in the compiler.

Parameters
[in]typeThe underlying type of the enum.
[in]nameThe name of the enum type.