Crypto++ 8.7
Free C++ class library of cryptographic schemes
|
Debugging and diagnostic assertions. More...
Go to the source code of this file.
Classes | |
class | DebugTrapHandler |
Default SIGTRAP handler. More... | |
Macros | |
#define | CRYPTOPP_ASSERT(exp) { ... } |
Debugging and diagnostic assertion. More... | |
Debugging and diagnostic assertions.
CRYPTOPP_ASSERT
is the library's debugging and diagnostic assertion. CRYPTOPP_ASSERT
is enabled by CRYPTOPP_DEBUG
, DEBUG
or _DEBUG
.
CRYPTOPP_ASSERT
raises a SIGTRAP
(Unix) or calls DebugBreak()
(Windows).
CRYPTOPP_ASSERT
is only in effect when the user requests a debug configuration. NDEBUG
(or failure to define it) does not affect CRYPTOPP_ASSERT
.
Definition in file trap.h.
#define CRYPTOPP_ASSERT | ( | exp | ) | { ... } |
Debugging and diagnostic assertion.
CRYPTOPP_ASSERT
is the library's debugging and diagnostic assertion. CRYPTOPP_ASSERT
is enabled by the preprocessor macros CRYPTOPP_DEBUG
, DEBUG
or _DEBUG
.
CRYPTOPP_ASSERT
raises a SIGTRAP
(Unix) or calls DebugBreak()
(Windows). CRYPTOPP_ASSERT
is only in effect when the user explicitly requests a debug configuration.
If you want to ensure CRYPTOPP_ASSERT
is inert, then do not define CRYPTOPP_DEBUG
, DEBUG
or _DEBUG
. Avoiding the defines means CRYPTOPP_ASSERT
is preprocessed into an empty string.
The traditional Posix define NDEBUG
has no effect on CRYPTOPP_DEBUG
, CRYPTOPP_ASSERT
or DebugTrapHandler.
An example of using CRYPTOPP_ASSERT and DebugTrapHandler is shown below. The library's test program, cryptest.exe
(from test.cpp), exercises the structure:
#if defined(CRYPTOPP_DEBUG) && defined(UNIX_SIGNALS_AVAILABLE) static const DebugTrapHandler g_dummyHandler; #endif int main(int argc, char* argv[]) { CRYPTOPP_ASSERT(argv != nullptr); ... }