Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros
AssertMsg.h File Reference

assertion with message More...

#include <iostream>
#include <limbo/preprocessor/Msg.h>

Go to the source code of this file.

Classes

struct  limbo::StaticAssert< bool >
 static assertion More...
 
struct  limbo::StaticAssert< true >
 template specialization More...
 

Namespaces

 limbo
 namespace for Limbo
 

Macros

#define assert_msg(condition, message)
 assertion with message More...
 
#define limboAssertMsg(condition, args...)
 custom assertion with message More...
 
#define limboAssert(condition)
 custom assertion without message More...
 
#define limboStaticAssert(condition)
 compile time assertion More...
 

Detailed Description

assertion with message

macro: assert_msg (deprecated)

attribute: assertion with message. if defined NO_LIMBO_ASSERTION, call assert in STL; else call custom assertion

macro: limboAssertMsg, limboAssert

attribute: assertion with or without message. compared with assert in STL, it provides detailed information on the failures and positions

Author
Yibo Lin
Date
Nov 2014

Definition in file AssertMsg.h.

Macro Definition Documentation

#define assert_msg (   condition,
  message 
)
Value:
do { \
if (! (condition)) { \
std::cerr << __FILE__ << ":" << __LINE__ << ": " << __PRETTY_FUNCTION__ << ": Assertion `" << #condition << "' failed: " << message << std::endl; \
abort(); \
} \
} while (false)

assertion with message

deprecated

I leave it here for backward compatibility. custom assertion with message. example usage: assert_msg(condition, "this is " << value << " for test");

Definition at line 34 of file AssertMsg.h.

#define limboAssert (   condition)
Value:
do {\
if (!(condition)) \
{\
::limbo::limboPrintAssertMsg(#condition, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
abort(); \
}\
} while (false)
void limboPrintAssertMsg(const char *expr, const char *fileName, unsigned lineNum, const char *funcName, const char *format,...)
print message for assertion failure with additional message, see limboAssertMsg(condition, args...)
Definition: PrintMsg.h:163

custom assertion without message

example usage: limboAssert(a == 1);

Definition at line 64 of file AssertMsg.h.

#define limboAssertMsg (   condition,
  args... 
)
Value:
do {\
if (!(condition)) \
{\
::limbo::limboPrintAssertMsg(#condition, __FILE__, __LINE__, __PRETTY_FUNCTION__, args); \
abort(); \
}\
} while (false)
void limboPrintAssertMsg(const char *expr, const char *fileName, unsigned lineNum, const char *funcName, const char *format,...)
print message for assertion failure with additional message, see limboAssertMsg(condition, args...)
Definition: PrintMsg.h:163

custom assertion with message

example usage: limboAssertMsg(a == 1, "this is %s", name);

Definition at line 52 of file AssertMsg.h.

#define limboStaticAssert (   condition)
Value:
{\
limbo::StaticAssert<(condition) != 0>(); \
}

compile time assertion

Definition at line 87 of file AssertMsg.h.