mirror of https://github.com/bjornbytes/lovr.git
Make lovrAssert act like a function
`do {} while(0)` is the perfect way to make function-like macro act like a real function (require ;, encapsulate local variables)
This commit is contained in:
parent
1ec0a41bb8
commit
4139f0f180
|
@ -37,7 +37,7 @@
|
|||
typedef void errorFn(void*, const char*, va_list);
|
||||
void lovrSetErrorCallback(errorFn* callback, void* userdata);
|
||||
LOVR_NORETURN void lovrThrow(const char* format, ...);
|
||||
#define lovrAssert(c, ...) if (!(c)) { lovrThrow(__VA_ARGS__); }
|
||||
#define lovrAssert(c, ...) do { if (!(c)) { lovrThrow(__VA_ARGS__); } } while(0)
|
||||
#define lovrUnreachable() lovrThrow("Unreachable")
|
||||
|
||||
#ifdef LOVR_UNCHECKED
|
||||
|
|
Loading…
Reference in New Issue