#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <OpenImageIO/platform.h>
Go to the source code of this file.
Value:
: (
std::fprintf(stderr,
"%s:%u: %s: Assertion '%s' failed.\n", \
abort()))
auto fprintf(std::FILE *f, const S &fmt, const T &...args) -> int
ASSERT and ASSERT_MSG (and, ugh, ASSERTMSG) are deprecated assertion macros. They are deprecated for two reasons: (1) terrible names pollute the global namespace and might conflict with other packages; and (2) the fully unconditional nature of aborting even for release builds is unkind to applications. Consider these all to be deprecated and avoid using these macros.
DASSERT and DASSERT_MSG also are considered deprecated for the namespace reasons.
Definition at line 73 of file dassert.h.
#define ASSERT_MSG |
( |
|
x, |
|
|
|
msg, |
|
|
|
... |
|
) |
| |
Value:
"%s:%u: %s: Assertion '%s' failed: " msg "\n", \
__VA_ARGS__), \
abort()))
auto fprintf(std::FILE *f, const S &fmt, const T &...args) -> int
Definition at line 82 of file dassert.h.
#define DASSERT |
( |
|
x | ) |
assert(x) |
DASSERT(condition) is just an alias for the usual assert() macro. It does nothing when in a non-DEBUG (optimized, shipping) build.
Definition at line 100 of file dassert.h.
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.
Definition at line 110 of file dassert.h.
#define OIIO_ABORT_IF_DEBUG abort() |
OIIO_ABORT_IF_DEBUG is a call to abort() for debug builds, but does nothing for release builds.
Definition at line 18 of file dassert.h.
Value:
: (
std::fprintf(stderr,
"%s:%u: %s: Assertion '%s' failed.\n", \
auto fprintf(std::FILE *f, const S &fmt, const T &...args) -> int
#define OIIO_ABORT_IF_DEBUG
OIIO_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 additionally aborts if in debug mode. When in release mode, it prints the error message if the condition fails, but does not abort.
OIIO_ASSERT_MSG(condition,msg,...) lets you add formatted output (a la printf) to the failure message.
Definition at line 32 of file dassert.h.
#define OIIO_ASSERT_MSG |
( |
|
x, |
|
|
|
msg, |
|
|
|
... |
|
) |
| |
Value:
: (
std::fprintf(stderr,
"%s:%u: %s: Assertion '%s' failed: " msg
"\n", \
auto fprintf(std::FILE *f, const S &fmt, const T &...args) -> int
#define OIIO_ABORT_IF_DEBUG
Definition at line 38 of file dassert.h.
OIIO_DASSERT and OIIO_DASSERT_MSG are the same as OIIO_ASSERT for debug builds (test, print error, abort), but do nothing at all in release builds (not even perform the test). This is similar to C/C++ assert(), but gives us flexibility in improving our error messages. It is also ok to use regular assert() for this purpose if you need to eliminate the dependency on this header from a particular place (and don't mind that assert won't format identically on all platforms).
Definition at line 55 of file dassert.h.
#define OIIO_STATIC_ASSERT |
( |
|
cond | ) |
static_assert(cond, "") |
#define OIIO_STATIC_ASSERT_MSG |
( |
|
cond, |
|
|
|
msg |
|
) |
| static_assert(cond, msg) |
Deprecated synonym:
Definition at line 130 of file dassert.h.