Skip to content

moon-chilled/Defer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This library implements a 'Defer' statement in c, allowing statements to run at
function return time, generally to do cleanup.  It is similar to 'defer' in Go
and to 'scope(exit)' in D, but note that it does not care about lexical scopes.
Integrating it into your codebase is simple; see demo.c for example usage.

Note: this is likely to be noticeably faster with compilers that support the GNU
C extensions; if you are on windows and performance is something you care about,
try Clang or MinGW.

Note: at the moment, a maximum of 32 deferred statements per function is
supported.  To change this number, #define DEFER_MAX_DEFERRED_STATEMENTS to a
different value before including defer.h (or via a compiler flag).

About

A Defer statement for C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published