Blaze 3.9
Macros | Functions
Run time assertions

Macros

#define BLAZE_INTERNAL_ASSERT(expr, msg)
 Run time assertion macro for internal checks. More...
 
#define BLAZE_USER_ASSERT(expr, msg)
 Run time assertion macro for user checks. More...
 

Functions

bool blaze::ASSERT_MESSAGE (const char *)
 Assertion helper function. More...
 

Detailed Description

Macro Definition Documentation

◆ BLAZE_INTERNAL_ASSERT

#define BLAZE_INTERNAL_ASSERT (   expr,
  msg 
)

Run time assertion macro for internal checks.

In case of an invalid run time expression, the program execution is terminated.
The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.

◆ BLAZE_USER_ASSERT

#define BLAZE_USER_ASSERT (   expr,
  msg 
)

Run time assertion macro for user checks.

In case of an invalid run time expression, the program execution is terminated.
The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.

Function Documentation

◆ ASSERT_MESSAGE()

bool blaze::ASSERT_MESSAGE ( const char *  )
inline

Assertion helper function.

The ASSERT_MESSAGE function is a small helper function to assist in printing an informative message in case an assert fires. This function builds on the ideas of Matthew Wilson, who directly combines a C-string error message with the run time expression (Imperfect C++, ISBN: 0321228774):

assert( ... && "Error message" );
assert( ... || !"Error message" );

However, both approaches fail to compile without warning on certain compilers. Therefore this inline function is used instead of the direct approaches, which circumvents all compiler warnings:

assert( ... || ASSERT_MESSAGE( "Error message" ) );
bool ASSERT_MESSAGE(const char *)
Assertion helper function.
Definition: Assert.h:83