CARB_ASSERT#

Defined in carb/Defines.h

CARB_ASSERT(cond, ...)#

Performs an assertion check, 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 is evaluated as false, the assertion is dispatched. If g_carbAssert is non-nullptr, the carb::assert::IAssert::reportFailedAssertion2 function is called with carb::assert::Type::eAssert. This causes vectored assertion handlers to run and, depending on their result, execution may continue or a software breakpoint is triggered. If g_carbAssert is nullptr, the assertion information is printed to stderr and a software breakpoint is triggered.

See the main assert article .

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.