libebt 1.3.0 reviewDownload
libebt library provides a clean way of getting human-readable backtrace messages in C++. libebt uses the RAII (resource acquisitio
libebt library provides a clean way of getting human-readable backtrace messages in C++.
libebt uses the RAII (resource acquisition is initialisation) idiom to manage backtrace stack items without needing macros, control structures or an external debugger adding context to a function or block is done through a single simple variable declaration.
A typical application using libebt will produce errors along the lines of the following:
* When performing query 'app-editors/vim' from commandline:
-> When calculating dependencies for 'app-editors/vim':
-> When calculating dependencies for 'app-editors/vim-core':
-> When loading versions for 'gentoo::app-editors/vim-core':
-> When parsing version string '6.4_invalid_version_suffix':
Version error: '6.4_invalid_version_suffix' is invalid (unknown format at around character offset 3)
This is far more useful for both end users and developers than a simple context-free error message, and does not require the use of a debugger to generate the backtrace.
Here's a simple preprocessor. It takes the name of a file and copies each non-directive line to stdout. If a line starts with '#e ', it generates an error message from the rest of the line. If a line starts with '#i ', it includes the filename specified on the remainder of the line. Any other line starting with a '#' is an invalid directive.
Point to note:
- To avoid confusion with multiple libraries making use of libebt, a tag is used to keep track of the context.
- Rather than defining a specific exception class, libebt provides a libebt::Backtracable template class which can be used in conjunction with other exception heirarchies through multiple inheritance.
- Declaring context for a given block or function is as simple as declaring a variable.
- To avoid typing out libebt::Backtracable in several places, a typedef is used.
What's New in This Release:
A std::deque is now used internally rather than a std::list to cut down on the number of memory allocations.
libebt 1.3.0 search tags