This is Unofficial EPICS BASE Doxygen Site
epicsAssert.h File Reference

An EPICS-specific replacement for ANSI C's assert. More...

#include "libComAPI.h"
#include "compilerDependencies.h"
+ Include dependency graph for epicsAssert.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define epicsAssertAuthor   0
 Optional string giving the author's name. More...
 
#define assert(exp)
 Declare that a condition should be true. More...
 
#define STATIC_JOIN(x, y)   STATIC_JOIN2(x, y)
 
#define STATIC_JOIN2(x, y)   x ## y
 
#define STATIC_ASSERT(expr)
 Declare a condition that should be true at compile-time. More...
 

Detailed Description

An EPICS-specific replacement for ANSI C's assert.

Author
Jeffery O. Hill

To use this version just include:

#define epicsAssertAuthor "Code Author my@email.address"
#include <epicsAssert.h>

instead of

#include <assert.h>

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 expresstion evaluates to 0. The STATIC_ASSERT() macro can only be used where a typedef is syntactically legal.

Definition in file epicsAssert.h.

Macro Definition Documentation

#define assert (   exp)
Value:
((exp) ? (void)0 : \
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
void epicsAssert(const char *pFile, const unsigned line, const char *pExp, const char *pAuthorName)
Definition: osdAssert.c:24
#define epicsAssertAuthor
Optional string giving the author&#39;s name.
Definition: epicsAssert.h:54

Declare that a condition should be true.

Parameters
expExpression that should evaluate to True.

Definition at line 70 of file epicsAssert.h.

#define epicsAssertAuthor   0

Optional string giving the author's name.

Definition at line 54 of file epicsAssert.h.

#define STATIC_ASSERT (   expr)
Value:
typedef int STATIC_JOIN(static_assert_failed_at_line_, __LINE__) \
[ (expr) ? 1 : -1 ] EPICS_UNUSED
#define EPICS_UNUSED
#define STATIC_JOIN(x, y)
Definition: epicsAssert.h:80

Declare a condition that should be true at compile-time.

Parameters
exprA C/C++ const-expression that should evaluate to True.

Definition at line 86 of file epicsAssert.h.

#define STATIC_JOIN (   x,
 
)    STATIC_JOIN2(x, y)

Definition at line 80 of file epicsAssert.h.

#define STATIC_JOIN2 (   x,
 
)    x ## y

Definition at line 81 of file epicsAssert.h.