Implementation of macro KV_ASSERT. More...
#include "keyvalue/sys/exception/Exception.h"
Go to the source code of this file.
Defines | |
#define | KV_ASSERT(cond, msg) |
The assert macro. |
Implementation of macro KV_ASSERT.
#define KV_ASSERT | ( | cond, | ||
msg | ||||
) |
{ \ if (!(cond)) \ throw ::keyvalue::LogicError() & __FILE__ & " (" & __LINE__ & ") :\n" &\ msg; \ }
The assert macro.
This macro is a replacement for the C standard assert
macro. Its definition depends on whether the macro NDEBUG is defined or not.
When NDEBUG is not defined, KV_ASSERT checks if a condition holds and, when it does not, it throws a LogicError carrying information on the invalid condition and where it has occurred.
When NDEBUG is defined, KV_ASSERT does not do anything.
cond | : Condition to be tested; | |
msg | : Error message to be reported. |