Asserts and Panics

Using __ASSERT_DEBUG test macros can prevent many problems. They should be used liberally to check for silly parameters coming into functions, null pointers, and other error conditions. Many error conditions will not trip up the application straight away, but will lead to side effects later. If errors are caught as soon as they occur, debugging becomes much easier later. For example:

CMyClass::Function( CThing* aThing )
    {
    __ASSERT_DEBUG( aThing, Panic( EMyAppNullPointerInFunction ) );
    }