py/misc.h: Add MP_STATIC_ASSERT macro to do static assertions.

This commit is contained in:
Damien George 2018-05-18 13:10:31 +10:00
parent 769e37b646
commit 43d08d6dd6
1 changed files with 3 additions and 0 deletions

View File

@ -50,6 +50,9 @@ typedef unsigned int uint;
#define _MP_STRINGIFY(x) #x #define _MP_STRINGIFY(x) #x
#define MP_STRINGIFY(x) _MP_STRINGIFY(x) #define MP_STRINGIFY(x) _MP_STRINGIFY(x)
// Static assertion macro
#define MP_STATIC_ASSERT(cond) ((void)sizeof(char[1 - 2 * !(cond)]))
/** memory allocation ******************************************/ /** memory allocation ******************************************/
// TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element) // TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element)