OpenImageIO
|
#include <cstdio>
#include <cstdlib>
Go to the source code of this file.
Macros | |
#define | ASSERT(x) |
#define | ASSERT_MSG(x, msg,...) |
#define | ASSERTMSG ASSERT_MSG |
#define | DASSERT(x) ASSERT(x) |
#define | DASSERT_MSG ASSERT_MSG |
#define | DASSERTMSG DASSERT_MSG |
Handy macros for debugging assertions.
The presumed usage is that you want ASSERT for dire conditions that must be checked at runtime even in an optimized build. DASSERT is for checks we should do for debugging, but that we don't want to bother with in a shipping optimized build.
In both cases, these are NOT a substitute for actual error checking and recovery! Never ASSERT or DASSERT to check invalid user input, for example. They should be used only to verify that there aren't errors in the code that are so severe that there is no point even trying to recover gracefully.
#define ASSERT | ( | x | ) |
ASSERT(condition) checks if the condition is met, and if not, prints an error message indicating the module and line where the error occurred and then aborts.
#define ASSERT_MSG | ( | x, | |
msg, | |||
... | |||
) |
ASSERT_MSG(condition,msg,...) is like ASSERT, but lets you add formatted output (a la printf) to the failure message.
#define DASSERT | ( | x | ) | ASSERT(x) |
DASSERT(condition) is just like ASSERT, except that it only is functional in DEBUG mode, but does nothing when in a non-DEBUG (optimized, shipping) build.
#define DASSERT_MSG ASSERT_MSG |
DASSERT_MSG(condition,msg,...) is just like ASSERT_MSG, except that it only is functional in DEBUG mode, but does nothing when in a non-DEBUG (optimized, shipping) build.