EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
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.
 
#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

Author
Jeffery O. Hill

To use this version just include:

#define epicsAssertAuthor "Code Author [email protected]"
#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 expression 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))
#define epicsAssertAuthor
Optional string giving the author&#39;s name.
Definition: epicsAssert.h:55
Parameters
expExpression that should evaluate to True.

Definition at line 71 of file epicsAssert.h.

#define STATIC_ASSERT (   expr)
Value:
typedef int STATIC_JOIN(static_assert_failed_at_line_, __LINE__) \
[ (expr) ? 1 : -1 ] EPICS_UNUSED
Parameters
exprA C/C++ const-expression that should evaluate to True.

Definition at line 87 of file epicsAssert.h.