[DOWNLOAD] CEXCEPT exception handling in C SourceForge

The cexcept project provides a simple error-handling interface, like that in C++, for the C programming language. It provides Try, Catch, and Throw macros that emulate the C++ try block and the catch and throw statements.

The authors of cexcept are Adam M. Costello (amc@cs.berkeley.edu) and Cosmin Truta (cosmin@cs.toronto.edu)

The "official" web site and a mailing list for this project are at www.cs.berkeley.edu/~amc/cexcept

"Released" versions are here at sourceforge.net

The SourceForge project summary page for cexcept is at sourceforge.net/projects/cexcept

Discussion of this project occurred on the png-implement(at)ccrc.wustl.edu mailing list beginning in mid-February 2000. It grew out of our desire to simplify the setjmp/longjmp method currently used in libpng. It moved out of beta with the release of version 1.0.0 in June 2000. Write to majordomo@ccrc.wustl.edu to subscribe to png-implement, or to one of us to find out about the message archives.

The cexcept package consists of a single cexcept.h file, plus documentation and examples.

The cexcept.h file is open source and may be used by anyone without payment of any fee to the authors of cexcept.h. Here are the notices that appear in cexcept.h:

Copyright (c) 2000 Adam M. Costello and Cosmin Truta. Everyone is hereby granted permission to do whatever they like with this file, provided that if they modify it they take reasonable steps to avoid confusing or misleading people about the authors and version of the derived file. The copyright holders make no guarantees about the correctness of this file, and are not responsible for any damage resulting from its use.


Similar work by others

  • GEF General Exception-Handling Facility (Bruce W. Bigby). A much more ambitious project. LGPL licensed.

  • The except.h file in the Exceptions and Assertions chapter of the book C Interfaces and Implementations. Source code is available on_line but all comments have been stripped out. Provides TRY, EXCEPT, ELSE, END_TRY, RAISE, RERAISE, RETURN, and FINALLY macros. License terms appear to be similar to those of the zlib license and the MIT license.

  • The Ex package, by Doug Gwyn. A copy of the 02-April-2000 version is provided here at cexcept.sourceforge.net/cexcept/ex.txt.gz, with the permission of the author. Provides five macros (ExTRY, ExCATCH, ExEXCEPT(), ExANY, and Ex_END) and three C functions (Ex_push(), Ex_pop(), and ExThrow() ). The Ex package as been placed in Public Domain by the author.

  • Ian Zimmerman's exc package uses a larger .c file and .h file and provides more features, like built-in support for polymorphic exceptions and multiple catch clauses, and detection of programmer errors like jumping out of a try clause (to accomplish this, the keyword return is redefined, which is very clever, although at most one package could use this trick at a time). The exc package is contained inside the larger gim package (in libgim/exc.*). Look for filenames beginning gim- in this directory.

This site is being maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).

Web space is provided by sourceforge.net

Updated August 11, 2000