CoronaAssert.h

Type C header
Revision 2017.3060
Keywords iOS, enterprise, C
See also

Overview

CoronaAssert.h contains helpful assertion macros for your C-based code.

All macros are prefixed with CORONA_

The macro CORONA_DEBUG must be defined to enable the assertions. By default, the macros are no-ops.

Macros

CORONA_ASSERT()

CORONA_ASSERT( cond )

Asserts that cond is true. If not, it generates an exception that the debugger can trap.

CORONA_VERIFY()

CORONA_VERIFY( cond )

Similar to CORONA_ASSERT() but when assertions are disabled (i.e. CORONA_DEBUG is not defined), the value of cond is evaluated and available for us in logical expressions.

This is useful where you want to gracefully handle failures at runtime, but want to trap them during normal development

void *p = ...
if ( CORONA_ASSERT( p ) )
{
    // Do something
}

CORONA_ASSERT_NOT_IMPLEMENTED()

CORONA_ASSERT_NOT_IMPLEMENTED()

You can use as a placeholder to mark areas of code that still need implementation.

CORONA_ASSERT_NOT_REACHED()

CORONA_ASSERT_NOT_REACHED()

You should mark areas of code where code should never be reached. In systems programming, for example, you would place one after a continuation.