1register_assert_handler(3) Allegro manual register_assert_handler(3)
2
3
4
6 register_assert_handler - Registers a custom handler for assert fail‐
7 ures. Allegro game programming library.
8
10 #include <allegro.h>
11
12
13 void register_assert_handler(int (*handler)(const char *msg));
14
16 Supplies a custom handler function for dealing with assert failures.
17 Your callback will be passed a formatted error message in ASCII, and
18 should return non-zero if it has processed the error, or zero to con‐
19 tinue with the default actions. You could use this to ignore assert
20 failures, or to display the error messages on a graphics mode screen
21 without aborting the program. You can call this function even when
22 Allegro has not been initialised. Example:
23
24 int show_but_continue(const char *text)
25 {
26 alert("Uh oh...", "Fasten your seat belts.", text,
27 "&Go on!", NULL, 'g', 0);
28 return 1;
29 }
30 ...
31 register_assert(show_but_continue);
32 ASSERT(0); /* This won't crash the program now. */
33
34
36 al_assert(3), ASSERT(3), register_trace_handler(3)
37
38
39
40Allegro version 4.4.3 register_assert_handler(3)