10int array_exception(
int boolean) {
20int divzero_exception(
int boolean) {
30int overflow_exception(
int boolean) {
40int parsing_exception(
int boolean) {
50int all_exception(
int boolean) {
84 puts(
"DivZeroNoCatch");
106 overflow_exception(0);
108 overflow_exception(1);
113 overflow_exception(0);
115 overflow_exception(1);
124 parsing_exception(0);
126 parsing_exception(1);
131 parsing_exception(0);
133 parsing_exception(1);
159#pragma GCC diagnostic push
160#pragma GCC diagnostic ignored "-Wshadow"
162 n_log(
LOG_NOTICE,
"Trying mixed Try-Catch blocks, we are inside block 1");
168 n_log(
LOG_NOTICE,
"Caught signal matching GENERAL_EXCEPTION inside block 2");
174 n_log(
LOG_NOTICE,
"Caught signal matching GENERAL_EXCEPTION inside block 1");
177#pragma GCC diagnostic pop
#define Throw(X)
Macro helper for adding exception throwing in custom functions.
#define OVERFLOW_EXCEPTION
Possibly Throwed value, we checked an overflow in our arrays.
#define Try
Macro for replacing try.
#define GENERAL_EXCEPTION
General exception, we just detected an error an decided to go back where we're safe.
#define PARSING_EXCEPTION
Possibly Throwed value, we checked an error during a char * parsing.
#define ARRAY_EXCEPTION
Possibly Throwed value, we checked an out of bound operation.
#define Catch(X)
Macro for replacing catch.
#define DIVZERO_EXCEPTION
Possibly Throwed value, we check a divide by zero operation.
#define EndTry
Macro helper for closing the try-catch block.
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
#define LOG_DEBUG
debug-level messages
#define LOG_STDERR
internal, default LOG_TYPE
void set_log_level(const int log_level)
Set the global log level value ( static int LOG_LEVEL )
#define LOG_NOTICE
normal but significant condition
#define LOG_INFO
informational
Exception management for C.