epicsAssert.h
An EPICS-specific replacement for ANSI C’s assert.
To use this version just include:
#define epicsAssertAuthor "Code Author my@email.address"
#include <epicsAssert.h>
#include <assert.h>
- Author
Jeffery O. Hill
If an assert() fails, it calls errlog indicating the program’s author, file name, and line number. Under each OS there are specialized instructions assisting the user to diagnose the problem and generate a good bug report. For instance, under vxWorks, there are instructions on how to generate a stack trace, and on posix there are instructions about saving the core file. After printing the message the calling thread is suspended. An author may, before the above include line, optionally define a preprocessor macro named epicsAssertAuthor as a string that provides their name and email address if they wish to be contacted when the assertion fires.
This header also provides a compile-time assertion macro STATIC_ASSERT() which can be used to check a constant-expression at compile-time. The C or C++ compiler will flag an error if the expression evaluates to 0. The STATIC_ASSERT() macro can only be used where a typedef is syntactically legal.
Defines
-
epicsAssertAuthor
Optional string giving the author’s name.
-
assert(exp)
Declare that a condition should be true.
- Parameters:
exp – Expression that should evaluate to True.
-
STATIC_JOIN(x, y, z, w)
-
STATIC_JOIN4(x, y, z, w)
-
STATIC_ASSERT_MSG(l)
-
STATIC_ASSERT(expr)
Declare a condition that should be true at compile-time.
- Parameters:
expr – A C/C++ const-expression that should evaluate to True.
Functions
-
void epicsAssert(const char *pFile, const unsigned line, const char *pExp, const char *pAuthorName)