Skip to content
  • Dmitry Kazakov's avatar
    Added a small KisAssert framework · 6c9a6c79
    Dmitry Kazakov authored
    Now if the error is not too much critical one can use KIS_ASSERT or
    KIS_ASSERT_RECOVER macros. These macros check the condition and ask
    the user what to do: try to continue or abort the program and see the
    backtrace.
    
    These macros can be use in the following way:
    
    KIS_ASSERT(condition);
    
    or
    
    KIS_ASSERT_RECOVER(condition) {
        // the code that recovers your program after a falure
    }
    
    There are three shortcuts available:
    
    KIS_ASSERT_RECOVER_BREAK(cond); --- calls 'break;'
    KIS_ASSERT_RECOVER_RETURN(cond); --- returns from current function
    KIS_ASSERT_RECOVER_RETURN_VALUE(cond, retval) --- returns from the function with some result
    
    WARNING: These asserts are supposed to be present even in NDEBUG mode!
    TODO: Implement automatic saving of the document. See the note
          in kis_assert.cpp
    6c9a6c79