Cambridge SMT System
custom_assert.hpp File Reference

Provides smarter assert methods. More...

#include <fstream>
#include <iostream>
#include "backtrace.hpp"
Include dependency graph for custom_assert.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define USER_CHECK_CONTINUE(exp, comment)   (bool)( (exp) || (check (#exp,#comment, __FILE__, __PRETTY_FUNCTION__,__LINE__,false), 0) )
 
#define USER_CHECK(exp, comment)   (bool)( (exp) || (check (#exp,#comment, __FILE__, __PRETTY_FUNCTION__,__LINE__,true), 0) )
 Tests whether exp is true. If not, comment is printed and program ends. More...
 

Functions

bool check (const char *expression, const char *message, const char *filename, const char *function, uint line, bool abort=true)
 Function that reports as many details as possible if the assertion USER_CHECK has failed. Combined with USER_CHECK, it reports file, function/class method, and file line. In addition, execution is ended unless USER_CHECK_DEBUG defined, and a reason is reported. the value returned by check can also be used to decide subsequent actions in USER_CHECK_DEBUG mode (e.g. return inmediately). check function also provides backtrace information to help the user. More...
 

Detailed Description

Provides smarter assert methods.

Date
8-8-2012
Author
Gonzalo Iglesias

Definition in file custom_assert.hpp.

Macro Definition Documentation

#define USER_CHECK (   exp,
  comment 
)    (bool)( (exp) || (check (#exp,#comment, __FILE__, __PRETTY_FUNCTION__,__LINE__,true), 0) )

Tests whether exp is true. If not, comment is printed and program ends.

Definition at line 41 of file custom_assert.hpp.

#define USER_CHECK_CONTINUE (   exp,
  comment 
)    (bool)( (exp) || (check (#exp,#comment, __FILE__, __PRETTY_FUNCTION__,__LINE__,false), 0) )

Definition at line 35 of file custom_assert.hpp.

Function Documentation

bool check ( const char *  expression,
const char *  message,
const char *  filename,
const char *  function,
uint  line,
bool  abort = true 
)
inline

Function that reports as many details as possible if the assertion USER_CHECK has failed. Combined with USER_CHECK, it reports file, function/class method, and file line. In addition, execution is ended unless USER_CHECK_DEBUG defined, and a reason is reported. the value returned by check can also be used to decide subsequent actions in USER_CHECK_DEBUG mode (e.g. return inmediately). check function also provides backtrace information to help the user.

Definition at line 51 of file custom_assert.hpp.

Here is the call graph for this function:

Here is the caller graph for this function: