CARB_ASSERT

Defined in carb/Defines.h

CARB_ASSERT(cond, ...)

Optionally performs an assertion, by default for debug builds only.

The implementation can be overridden on the command line, or by defining to a different implementation before including this file.

When cond produces a false result, the failure is reported to the g_carbAssert assertion handler, or if that global variable is nullptr, calls carb::assertHandlerFallback(). Depending on the result from that function call, execution is allowed to continue, or CARB_BREAK_POINT() is invoked to notify the debugger.

Note

The CARB_ASSERT_ENABLED define can be used to determine if asserts are enabled, or to cause them to be enabled or disabled by defining it before including this file.

Warning

The cond should have no side effects! Asserts can be disabled which will cause cond to not be evaluated.

Parameters
  • cond – A condition that is evaluated for a boolean result. If the condition produces false, the assert handler is notified.

  • ... – An optional printf-style format string and variadic parameters.