<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.14"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Crypto++: trap.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Crypto++  <span id="projectnumber">7.0</span> </div> <div id="projectbrief">Free C++ class library of cryptographic schemes</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.14 --> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',false,false,'search.php','Search'); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> | <a href="#define-members">Macros</a> </div> <div class="headertitle"> <div class="title">trap.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>Debugging and diagnostic assertions. <a href="#details">More...</a></p> <p><a href="trap_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Classes</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_debug_trap_handler.html">DebugTrapHandler</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Default SIGTRAP handler. <a href="class_debug_trap_handler.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:adf3b392588bc94cbeae9f415a78c7b95"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="trap_8h.html#adf3b392588bc94cbeae9f415a78c7b95">CRYPTOPP_ASSERT</a>(exp)   { ... }</td></tr> <tr class="memdesc:adf3b392588bc94cbeae9f415a78c7b95"><td class="mdescLeft"> </td><td class="mdescRight">Debugging and diagnostic assertion. <a href="#adf3b392588bc94cbeae9f415a78c7b95">More...</a><br /></td></tr> <tr class="separator:adf3b392588bc94cbeae9f415a78c7b95"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Debugging and diagnostic assertions. </p> <p><code>CRYPTOPP_ASSERT</code> is the library's debugging and diagnostic assertion. <code>CRYPTOPP_ASSERT</code> is enabled by <code>CRYPTOPP_DEBUG</code>, <code>DEBUG</code> or <code>_DEBUG</code>.</p> <p><code>CRYPTOPP_ASSERT</code> raises a <code>SIGTRAP</code> (Unix) or calls <code>__debugbreak()</code> (Windows). <code>CRYPTOPP_ASSERT</code> is only in effect when the user requests a debug configuration. Unlike Posix assert, <code>NDEBUG</code> (or failure to define it) does not affect the library. The traditional Posix define <code>NDEBUG</code> has no effect on <code>CRYPTOPP_DEBUG</code> or <a class="el" href="class_debug_trap_handler.html" title="Default SIGTRAP handler. ">DebugTrapHandler</a>. </p><dl class="section since"><dt>Since</dt><dd>Crypto++ 5.6.5 </dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_debug_trap_handler.html" title="Default SIGTRAP handler. ">DebugTrapHandler</a>, <a href="http://github.com/weidai11/cryptopp/issues/277">Issue 277</a>, <a href="http://seclists.org/oss-sec/2016/q3/520">CVE-2016-7420</a> </dd></dl> <p class="definition">Definition in file <a class="el" href="trap_8h_source.html">trap.h</a>.</p> </div><h2 class="groupheader">Macro Definition Documentation</h2> <a id="adf3b392588bc94cbeae9f415a78c7b95"></a> <h2 class="memtitle"><span class="permalink"><a href="#adf3b392588bc94cbeae9f415a78c7b95">◆ </a></span>CRYPTOPP_ASSERT</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define CRYPTOPP_ASSERT</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">exp</td><td>)</td> <td>   { ... }</td> </tr> </table> </div><div class="memdoc"> <p>Debugging and diagnostic assertion. </p> <p><code>CRYPTOPP_ASSERT</code> is the library's debugging and diagnostic assertion. <code>CRYPTOPP_ASSERT</code> is enabled by the preprocessor macros <code>CRYPTOPP_DEBUG</code>, <code>DEBUG</code> or <code>_DEBUG</code>.</p> <p><code>CRYPTOPP_ASSERT</code> raises a <code>SIGTRAP</code> (Unix) or calls <code>DebugBreak()</code> (Windows). <code>CRYPTOPP_ASSERT</code> is only in effect when the user explicitly requests a debug configuration.</p> <p>If you want to ensure <code>CRYPTOPP_ASSERT</code> is inert, then <em>do not</em> define <code>CRYPTOPP_DEBUG</code>, <code>DEBUG</code> or <code>_DEBUG</code>. Avoiding the defines means <code>CRYPTOPP_ASSERT</code> is preprocessed into an empty string.</p> <p>The traditional Posix define <code>NDEBUG</code> has no effect on <code>CRYPTOPP_DEBUG</code>, <code>CRYPTOPP_ASSERT</code> or <a class="el" href="class_debug_trap_handler.html" title="Default SIGTRAP handler. ">DebugTrapHandler</a>.</p> <p>An example of using <a class="el" href="trap_8h.html#adf3b392588bc94cbeae9f415a78c7b95">CRYPTOPP_ASSERT</a> and <a class="el" href="class_debug_trap_handler.html" title="Default SIGTRAP handler. ">DebugTrapHandler</a> is shown below. The library's test program, <code>cryptest.exe</code> (from test.cpp), exercises the structure: </p><pre> #if defined(CRYPTOPP_DEBUG) && defined(UNIX_SIGNALS_AVAILABLE) static const <a class="el" href="class_debug_trap_handler.html" title="Default SIGTRAP handler. ">DebugTrapHandler</a> g_dummyHandler; #endif</pre><pre> int main(int argc, char* argv[]) { CRYPTOPP_ASSERT(argv != nullptr); ... } </pre> <dl class="section since"><dt>Since</dt><dd>Crypto++ 5.6.5 </dd></dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_debug_trap_handler.html" title="Default SIGTRAP handler. ">DebugTrapHandler</a>, <a class="el" href="struct_signal_handler.html" title="Signal handler for Linux and Unix compatibles. ">SignalHandler</a>, <a href="http://github.com/weidai11/cryptopp/issues/277">Issue 277</a>, <a href="http://seclists.org/oss-sec/2016/q3/520">CVE-2016-7420</a> </dd></dl> <p class="definition">Definition at line <a class="el" href="trap_8h_source.html#l00060">60</a> of file <a class="el" href="trap_8h_source.html">trap.h</a>.</p> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Sun Sep 16 2018 07:58:11 for Crypto++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.14 </small></address> </body> </html>