My Project
programmer's documentation
Macros
cs_assert.h File Reference
#include <mpi.h>
#include "cs_defs.h"
#include "bft_error.h"
Include dependency graph for cs_assert.h:

Go to the source code of this file.

Macros

#define cs_assert(expr)
 Abort the program if the given assertion is false. More...
 

Detailed Description

Assertion usable in all build types.

Macro Definition Documentation

◆ cs_assert

#define cs_assert (   expr)
Value:
if (!(expr)) bft_error(__FILE__, __LINE__, 0, \
"Assertion failed in function %s: %s", \
__func__, # expr)

Abort the program if the given assertion is false.

Contrary to the standard C assert macro, this is always defined, so the standard C assert macro should be use for debug build-only checking, whereas this macros should be used mainly for less expensive argument or precondition checks that should be present in all build types.

Parameters
[in]exprexpression to verify
bft_error
void bft_error(const char *const file_name, const int line_num, const int sys_error_code, const char *const format,...)
Calls the error handler (set by bft_error_handler_set() or default).
Definition: bft_error.c:193