The Exception Handling Library  0.2.1
Functions | Variables
except.c File Reference

Source for Exception Handling Library (CBL) More...

#include <stddef.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include "cbl/assert.h"
#include "except.h"
Include dependency graph for except.c:

Functions

void() except_raise (const except_t *e, const char *file, int line)
 raises an exception and set its information properly.

Variables

except_frame_t * except_stack = NULL
 stack for handling nested exceptions.

Detailed Description

Source for Exception Handling Library (CBL)


Function Documentation

void() except_raise ( const except_t *  e,
const char *  file,
int  line 
)

raises an exception and set its information properly.

EXCEPT_RAISE and EXCEPT_RERAISE macros call except_raise() with __FILE__ and __LINE__ predefined macros (and __func__ if C99 supported) for the file and line parameters. In general there is little chance to call except_raise() directly from application code.

Possible exceptions: assert_exceptfail

Unchecked errors: foreign data structure given for e

Parameters:
[in]eexception to raise
[in]filefile name where exception occurred
[in]funcfunction name where exception occurred (if C99 supported)
[in]lineline number where exception occurred
Returns:
except_raise() cannot return anything
Todo:
Improvements are possible and planned:
  • it would be useful to show stack traces when an uncaught exception leads to abortion of a program. The stack traces should include as much information as possible, for example, names of caller functions, calling sites (file name, function name and line number) and arguments.
 All Files Functions Variables Enumerator Defines