Skip to content

Commit 43d08d6

Browse files
committed
py/misc.h: Add MP_STATIC_ASSERT macro to do static assertions.
1 parent 769e37b commit 43d08d6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

py/misc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ typedef unsigned int uint;
5050
#define _MP_STRINGIFY(x) #x
5151
#define MP_STRINGIFY(x) _MP_STRINGIFY(x)
5252

53+
// Static assertion macro
54+
#define MP_STATIC_ASSERT(cond) ((void)sizeof(char[1 - 2 * !(cond)]))
55+
5356
/** memory allocation ******************************************/
5457

5558
// TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element)

0 commit comments

Comments
 (0)