Skip to content
🌋️
Alchemy
Theme: Weyard
Theme: Modern
Mode: Auto
Mode: Light
Mode: Dark
Alchemy
Source
Reference
Loading...
Searching...
No Matches
static_assert.h
Go to the documentation of this file.
1
#ifndef ALCHEMY_STATIC_ASSERT_H
2
#define ALCHEMY_STATIC_ASSERT_H
3
4
/// @file
5
/// STATIC_ASSERT, a compile-time check that emits nothing.
6
7
#include "
types.h
"
8
#include "
stddef.h
"
9
10
#ifdef MODERN
11
#define STATIC_ASSERT(condition) _Static_assert((condition), #condition)
12
#else
13
/// C89 permits repeated extern declarations of the same array. A false
14
/// condition gives it an invalid size; a true one emits no code or storage.
15
#define STATIC_ASSERT(condition) \
16
extern char alchemyStaticAssertion[(condition) ? 1 : -1]
17
#endif
18
19
#endif
stddef.h
size_t, ptrdiff_t, wchar_t, NULL and offsetof, as the C library defines them.
types.h
The integer types, TRUE, UNUSED and the fixed-address macros.
include
lib
static_assert.h