mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Add STATIC_ASSERT() macro and use it
This commit is contained in:
parent
c56d7fe0eb
commit
688556a5d1
2 changed files with 9 additions and 2 deletions
|
@ -38,4 +38,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
C(const C &); \
|
||||
C &operator=(const C &)
|
||||
|
||||
// Fail compilation if condition expr is not met.
|
||||
// Note that 'msg' must follow the format of a valid identifier, e.g.
|
||||
// STATIC_ASSERT(sizeof(foobar_t) == 40), foobar_t_is_wrong_size);
|
||||
#define STATIC_ASSERT(expr, msg) typedef char msg[!!(expr) * 2 - 1]
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue