jigdo API

util/debug.hh File Reference

Debugging aids, including Error objects and assertions. More...

#include <config.h>
#include <algorithm>
#include <string>

Go to the source code of this file.


Namespaces

namespace  Debug

Classes

struct  Error
 The messages are always in UTF-8! More...
struct  Cleanup
 Thrown to indicate: Don't report anything, but unwind stack and return specified value from main(). More...

Defines

#define UNUSED_PARAM(_p)
#define DEBUG_ONLY_PARAM(_p)
 To avoid warnings if a function argument is only used by Paranoid(), i.e.
#define Paranoid(expr)
#define Assert(_expr)
#define Message(_str)   Debug::assertFail((_str), __FILE__, __LINE__)

Functions

int Debug::assertFail (const char *assertion, const char *file, unsigned int line)
 Print an "Assertion failed" message.

Variables

bool Debug::abortAfterFailedAssertion = true
 True if to call abort() after failed assertion.

Detailed Description

Debugging aids, including Error objects and assertions.

The Error class is just a convenient base class for all kinds of errors which result in a text error message for printing to the user.

'Paranoid()' is only compiled in if DEBUG is defined. 'Assert()' is always compiled in.

General rule of thumb: 'Assert' is used to check things possibly passed from other modules, 'Paranoid' for consistency checks where only the current module changes the state. ('Module' = e.g. source file and accompanying header, but may be >1 source file if appropriate.)


Define Documentation

#define DEBUG_ONLY_PARAM ( _p   ) 

To avoid warnings if a function argument is only used by Paranoid(), i.e.

only if DEBUG is defined

#define Message ( _str   )     Debug::assertFail((_str), __FILE__, __LINE__)

#define UNUSED_PARAM ( _p   ) 


Generated on Tue Sep 23 14:27:42 2008 for jigdo by  doxygen 1.5.6