Core Library
Classes | Namespaces | Defines | Functions
Debug.hpp File Reference

Debug reporting functions and macros. More...

Classes

struct  Core::STATIC_ASSERT_CHECK< true >
 The STATIC_ASSERT template matching valid assertions. More...

Namespaces

namespace  Core
 

The Core Library namespace.


Defines

#define ASSERT(x)   if (x) {} else Core::assertFail((#x), __FILE__, __LINE__)
 Evaluate the expression, and complain if 'false'.
#define ASSERT_FALSE()   Core::assertFail("FALSE", __FILE__, __LINE__)
 Always fail.
#define TRACE(x)   Core::traceEx(x)
#define TRACE1(x, a)   Core::traceEx(x, a)
#define TRACE2(x, a, b)   Core::traceEx(x, a, b)
#define TRACE3(x, a, b, c)   Core::traceEx(x, a, b, c)
#define TRACE4(x, a, b, c, d)   Core::traceEx(x, a, b, c, d)
#define TRACE5(x, a, b, c, d, e)   Core::traceEx(x, a, b, c, d, e)
#define DBGCRT_NEW   new(_NORMAL_BLOCK, __FILE__, __LINE__)
 Map calls to 'new' to the debug version and track the file and line number.
#define new   DBGCRT_NEW
 Enable tracking of 'new' calls by default.
#define DEBUG_USE_ONLY(x)   ((void)x)
 Mark a variable as only used in debug to avoid 'unreferenced variable' warnings.
#define UNUSED_VARIABLE(x)   (x)
 Mark a variable or parameter as unused in any build.
#define STATIC_ASSERT(x)   enum { static_assert##__LINE__ = sizeof(Core::STATIC_ASSERT_CHECK<(x)>) };
 Compile time ASSERT.

Functions

void Core::enableLeakReporting (bool bEnable)
 Enable or disable memory leak reporting.
void Core::debugWrite (const tchar *pszFormat,...)
 Write a message to the debugger stream in both Debug and Release builds.
void Core::assertFail (const char *pszExpression, const char *pszFile, uint nLine)
 The function invoked when an ASSERT fails.
void Core::traceEx (const tchar *pszFormat,...)
 Function to write a message to the debugger output.

Detailed Description

Debug reporting functions and macros.

Author:
Chris Oldwood

Define Documentation

#define ASSERT (   x)    if (x) {} else Core::assertFail((#x), __FILE__, __LINE__)

Evaluate the expression, and complain if 'false'.

#define ASSERT_FALSE ( )    Core::assertFail("FALSE", __FILE__, __LINE__)

Always fail.

#define TRACE (   x)    Core::traceEx(x)
#define TRACE1 (   x,
 
)    Core::traceEx(x, a)
#define TRACE2 (   x,
  a,
 
)    Core::traceEx(x, a, b)
#define TRACE3 (   x,
  a,
  b,
 
)    Core::traceEx(x, a, b, c)
#define TRACE4 (   x,
  a,
  b,
  c,
 
)    Core::traceEx(x, a, b, c, d)
#define TRACE5 (   x,
  a,
  b,
  c,
  d,
 
)    Core::traceEx(x, a, b, c, d, e)
#define DBGCRT_NEW   new(_NORMAL_BLOCK, __FILE__, __LINE__)

Map calls to 'new' to the debug version and track the file and line number.

#define new   DBGCRT_NEW

Enable tracking of 'new' calls by default.

#define DEBUG_USE_ONLY (   x)    ((void)x)

Mark a variable as only used in debug to avoid 'unreferenced variable' warnings.

#define UNUSED_VARIABLE (   x)    (x)

Mark a variable or parameter as unused in any build.

#define STATIC_ASSERT (   x)    enum { static_assert##__LINE__ = sizeof(Core::STATIC_ASSERT_CHECK<(x)>) };

Compile time ASSERT.