AutosarOS
|
Assert macros and functions. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | assert(expression) |
#define | assertMsg(expression, message) |
#define | ASSERT_BUFFER_SIZE size |
#define | STATIC_ASSERT_BUFFER |
If defined the error buffer will be declared as static. More... | |
#define | BREAK_ON_ASSERT |
If this is defined a break opcode will be executed before abort() is called. More... | |
Assert macros and functions.
Definition in file assert.h.
#define assert | ( | expression | ) |
expression | Expression to test for |
The assert() macro tests the given expression and if it is false, the calling process is terminated. A diagnostic message is written to the error buffer and the function abort() is called, effectively terminating the program.
If expression is true, the assert() macro does nothing.
The assert() macro may be removed at compile time by defining NDEBUG as a macro (e.g., by using the compiler option -DNDEBUG).
#define ASSERT_BUFFER_SIZE size |
#define assertMsg | ( | expression, | |
message | |||
) |
expression | Expression to test for |
message | Message to write instead of expression |
The assert() macro tests the given expression and if it is false, the calling process is terminated. The passed message is written to the error buffer and the function abort() is called, effectively terminating the program.
If expression is true, the assert() macro does nothing.
The assertMsg() macro may be removed at compile time by defining NDEBUG as a macro (e.g., by using the compiler option -DNDEBUG).
#define BREAK_ON_ASSERT |