Try/Catch & Exception implementation written in C.
Go to file
2024-11-15 15:53:42 -06:00
include Initial Commit 2024-11-15 15:53:42 -06:00
src Initial Commit 2024-11-15 15:53:42 -06:00
tests Initial Commit 2024-11-15 15:53:42 -06:00
LICENSE Initial Commit 2024-11-15 15:53:42 -06:00
Makefile Initial Commit 2024-11-15 15:53:42 -06:00
README.md Initial Commit 2024-11-15 15:53:42 -06:00

Except

Description

Exception implementation written in C.

Table of Contents

Features / TODOS

  • RAISE - Raise an exception.
  • RERAISE - Reraise the current exception.
  • RETURN - Switch to the previous exception frame and return.
  • TRY - Start a try block.
  • EXCEPT - Catch a specific exception.
  • ELSE - Catch all other exceptions.
  • FINALLY - Execute final code.
  • END_TRY - End a try block.
  • hard_fail(char * fmt, ...) - Print errno along with msg to stderr and exit.

Usage

except.c and except.h should be dropped into an existing project and compiled along with it.

make test to build and test project. Tests usually contain usage examples.
make to build the project.

Credits / Resources

I found these resources extremely helpful.
C Interfaces and Implementations - David Hanson
Jacob Sorber

License

This project is licensed under GPLv3 - see the LICENSE file for details.