Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
static void my_assertion_proc(const char* message)
{
    printf("It's OK. I caught the assertion: %s\n", message);
    // Do something like throw MyProj::FatalException(message);
}

int main(int argc, char **argv)
{
    codes_set_codes_assertion_failed_proc(&my_assertion_proc);

    // All asserts in the ecCodes library will now be caught
    ...

    // Now restore default behaviour
    codes_set_codes_assertion_failed_proc(NULL);

    return 0;
}

...