1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853
|
<!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"/>
<title>wxWidgets: Debugging macros</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" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
<tbody>
<tr>
<td id="projectlogo">
<a href="http://www.wxwidgets.org/" target="_new">
<img alt="wxWidgets" src="logo.png"/>
</a>
</td>
<td style="padding-left: 0.5em; text-align: right;">
<span id="projectnumber">Version: 3.0.2</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Categories</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> |
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Debugging macros</div> </div>
<div class="ingroups"><a class="el" href="group__group__funcmacro.html">Functions and Macros by Category</a></div></div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Useful macros and functions for error checking and defensive programming. </p>
<p>Starting with wxWidgets 2.9.1, debugging support in wxWidgets is always compiled in by default, you need to explicitly define <a class="el" href="group__group__funcmacro__debug.html#ga7ce424d27d39bb92c26c80b6a1903725" title="Preprocessor symbol defining the level of debug support available.">wxDEBUG_LEVEL</a> as 0 to disable it completely. However, by default debugging macros are dormant in the release builds, i.e. when the main program is compiled with the standard <code>NDEBUG</code> symbol being defined. You may explicitly activate the debugging checks in the release build by calling <a class="el" href="group__group__funcmacro__debug.html#ga7a8443c97e45d2943f03769aaa787376" title="Sets the function to be called in case of assertion failure.">wxSetAssertHandler()</a> with a custom function if needed.</p>
<p>When debugging support is active, failure of both <a class="el" href="group__group__funcmacro__debug.html#ga204cc264ee560b67e6c6467ba8ffee5f" title="Assert macro.">wxASSERT()</a> and <a class="el" href="group__group__funcmacro__debug.html#gacce4d688e56d4de1bbef692e7df2e3e3" title="Checks that the condition is true, returns with the given return value if not (stops execution in deb...">wxCHECK()</a> macros conditions result in a debug alert. When debugging support is inactive or turned off entirely at compilation time, <a class="el" href="group__group__funcmacro__debug.html#ga204cc264ee560b67e6c6467ba8ffee5f" title="Assert macro.">wxASSERT()</a> and <a class="el" href="group__group__funcmacro__debug.html#gaa5b456751cd8c71e9a787fba16ecbd68" title="Will always generate an assert error if this code is reached (in debug mode).">wxFAIL()</a> macros don't do anything while <a class="el" href="group__group__funcmacro__debug.html#gacce4d688e56d4de1bbef692e7df2e3e3" title="Checks that the condition is true, returns with the given return value if not (stops execution in deb...">wxCHECK()</a> still checks its condition and returns if it fails, even if no alerts are shown to the user.</p>
<p>Finally, the compile time assertions don't happen during the run-time but result in the compilation error messages if the condition they check fail. They are always enabled and are not affected by <a class="el" href="group__group__funcmacro__debug.html#ga7ce424d27d39bb92c26c80b6a1903725" title="Preprocessor symbol defining the level of debug support available.">wxDEBUG_LEVEL</a>.</p>
<p>Related class group: <a class="el" href="group__group__class__debugging.html">Debugging</a>. </p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga8db18cbe95b3b42c3017a8bf048b0839"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga8db18cbe95b3b42c3017a8bf048b0839">wxDISABLE_DEBUG_SUPPORT</a>()</td></tr>
<tr class="memdesc:ga8db18cbe95b3b42c3017a8bf048b0839"><td class="mdescLeft"> </td><td class="mdescRight">Use this macro to disable all debugging code in release build when not using <a class="el" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP()</a>. <a href="#ga8db18cbe95b3b42c3017a8bf048b0839"></a><br/></td></tr>
<tr class="separator:ga8db18cbe95b3b42c3017a8bf048b0839"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga7ce424d27d39bb92c26c80b6a1903725"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga7ce424d27d39bb92c26c80b6a1903725">wxDEBUG_LEVEL</a></td></tr>
<tr class="memdesc:ga7ce424d27d39bb92c26c80b6a1903725"><td class="mdescLeft"> </td><td class="mdescRight">Preprocessor symbol defining the level of debug support available. <a href="#ga7ce424d27d39bb92c26c80b6a1903725"></a><br/></td></tr>
<tr class="separator:ga7ce424d27d39bb92c26c80b6a1903725"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga30ad68c25d4f7a731f60eb07419c2960"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga30ad68c25d4f7a731f60eb07419c2960">__WXDEBUG__</a></td></tr>
<tr class="memdesc:ga30ad68c25d4f7a731f60eb07419c2960"><td class="mdescLeft"> </td><td class="mdescRight">Compatibility macro indicating presence of debug support. <a href="#ga30ad68c25d4f7a731f60eb07419c2960"></a><br/></td></tr>
<tr class="separator:ga30ad68c25d4f7a731f60eb07419c2960"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga204cc264ee560b67e6c6467ba8ffee5f"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga204cc264ee560b67e6c6467ba8ffee5f">wxASSERT</a>(condition)</td></tr>
<tr class="memdesc:ga204cc264ee560b67e6c6467ba8ffee5f"><td class="mdescLeft"> </td><td class="mdescRight">Assert macro. <a href="#ga204cc264ee560b67e6c6467ba8ffee5f"></a><br/></td></tr>
<tr class="separator:ga204cc264ee560b67e6c6467ba8ffee5f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9ff90708a7b76e926493ac0860f6854c"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga9ff90708a7b76e926493ac0860f6854c">wxASSERT_LEVEL_2</a>(condition)</td></tr>
<tr class="memdesc:ga9ff90708a7b76e926493ac0860f6854c"><td class="mdescLeft"> </td><td class="mdescRight">Assert macro for expensive run-time checks. <a href="#ga9ff90708a7b76e926493ac0860f6854c"></a><br/></td></tr>
<tr class="separator:ga9ff90708a7b76e926493ac0860f6854c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf924de21e1d2b51a97886367b99851e7"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#gaf924de21e1d2b51a97886367b99851e7">wxASSERT_LEVEL_2_MSG</a>(condition, msg)</td></tr>
<tr class="memdesc:gaf924de21e1d2b51a97886367b99851e7"><td class="mdescLeft"> </td><td class="mdescRight">Assert macro with a custom message for expensive run-time checks. <a href="#gaf924de21e1d2b51a97886367b99851e7"></a><br/></td></tr>
<tr class="separator:gaf924de21e1d2b51a97886367b99851e7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gabcdb0bf7c5499469b40a8fe8206e2cbf"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#gabcdb0bf7c5499469b40a8fe8206e2cbf">wxASSERT_MIN_BITSIZE</a>(type, size)</td></tr>
<tr class="memdesc:gabcdb0bf7c5499469b40a8fe8206e2cbf"><td class="mdescLeft"> </td><td class="mdescRight">This macro results in a <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc">compile time assertion failure</a> if the size of the given <code>type</code> is less than <code>size</code> bits. <a href="#gabcdb0bf7c5499469b40a8fe8206e2cbf"></a><br/></td></tr>
<tr class="separator:gabcdb0bf7c5499469b40a8fe8206e2cbf"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga0224638a009ef6a78e09c0d3bb61c379"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga0224638a009ef6a78e09c0d3bb61c379">wxASSERT_MSG</a>(condition, message)</td></tr>
<tr class="memdesc:ga0224638a009ef6a78e09c0d3bb61c379"><td class="mdescLeft"> </td><td class="mdescRight">Assert macro with message. <a href="#ga0224638a009ef6a78e09c0d3bb61c379"></a><br/></td></tr>
<tr class="separator:ga0224638a009ef6a78e09c0d3bb61c379"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gacce4d688e56d4de1bbef692e7df2e3e3"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#gacce4d688e56d4de1bbef692e7df2e3e3">wxCHECK</a>(condition, retValue)</td></tr>
<tr class="memdesc:gacce4d688e56d4de1bbef692e7df2e3e3"><td class="mdescLeft"> </td><td class="mdescRight">Checks that the condition is <span class="literal">true</span>, returns with the given return value if not (stops execution in debug mode). <a href="#gacce4d688e56d4de1bbef692e7df2e3e3"></a><br/></td></tr>
<tr class="separator:gacce4d688e56d4de1bbef692e7df2e3e3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4822a2ea9fdd0bc98caa3ff42587743e"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga4822a2ea9fdd0bc98caa3ff42587743e">wxCHECK_MSG</a>(condition, retValue, message)</td></tr>
<tr class="memdesc:ga4822a2ea9fdd0bc98caa3ff42587743e"><td class="mdescLeft"> </td><td class="mdescRight">Checks that the condition is <span class="literal">true</span>, returns with the given return value if not (stops execution in debug mode). <a href="#ga4822a2ea9fdd0bc98caa3ff42587743e"></a><br/></td></tr>
<tr class="separator:ga4822a2ea9fdd0bc98caa3ff42587743e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga0cf2ca7d7ff0107197e51e6b434fd0bd"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga0cf2ca7d7ff0107197e51e6b434fd0bd">wxCHECK_RET</a>(condition, message)</td></tr>
<tr class="memdesc:ga0cf2ca7d7ff0107197e51e6b434fd0bd"><td class="mdescLeft"> </td><td class="mdescRight">Checks that the condition is <span class="literal">true</span>, and returns if not (stops execution with the given error message in debug mode). <a href="#ga0cf2ca7d7ff0107197e51e6b434fd0bd"></a><br/></td></tr>
<tr class="separator:ga0cf2ca7d7ff0107197e51e6b434fd0bd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga2a551ae1dcd439257d35a9b0b6ed483c"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga2a551ae1dcd439257d35a9b0b6ed483c">wxCHECK2</a>(condition, operation)</td></tr>
<tr class="memdesc:ga2a551ae1dcd439257d35a9b0b6ed483c"><td class="mdescLeft"> </td><td class="mdescRight">Checks that the condition is <span class="literal">true</span>, and if not, it will <a class="el" href="group__group__funcmacro__debug.html#gaa5b456751cd8c71e9a787fba16ecbd68" title="Will always generate an assert error if this code is reached (in debug mode).">wxFAIL()</a> and execute the given <code>operation</code> if it is not. <a href="#ga2a551ae1dcd439257d35a9b0b6ed483c"></a><br/></td></tr>
<tr class="separator:ga2a551ae1dcd439257d35a9b0b6ed483c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad9673fe2c9e69d6b41f0175b151060d0"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#gad9673fe2c9e69d6b41f0175b151060d0">wxCHECK2_MSG</a>(condition, operation, message)</td></tr>
<tr class="memdesc:gad9673fe2c9e69d6b41f0175b151060d0"><td class="mdescLeft"> </td><td class="mdescRight">This is the same as <a class="el" href="group__group__funcmacro__debug.html#ga2a551ae1dcd439257d35a9b0b6ed483c" title="Checks that the condition is true, and if not, it will wxFAIL() and execute the given operation if it...">wxCHECK2()</a>, but <a class="el" href="group__group__funcmacro__debug.html#ga4d129eca8fff062a65dec065edca085e" title="Will always generate an assert error with specified message if this code is reached (in debug mode)...">wxFAIL_MSG()</a> with the specified <code>message</code> is called instead of <a class="el" href="group__group__funcmacro__debug.html#gaa5b456751cd8c71e9a787fba16ecbd68" title="Will always generate an assert error if this code is reached (in debug mode).">wxFAIL()</a> if the <code>condition</code> is <span class="literal">false</span>. <a href="#gad9673fe2c9e69d6b41f0175b151060d0"></a><br/></td></tr>
<tr class="separator:gad9673fe2c9e69d6b41f0175b151060d0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gade23c9c38d065845dc040e31525befdc"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc">wxCOMPILE_TIME_ASSERT</a>(condition, message)</td></tr>
<tr class="memdesc:gade23c9c38d065845dc040e31525befdc"><td class="mdescLeft"> </td><td class="mdescRight">Using <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc" title="Using wxCOMPILE_TIME_ASSERT() results in a compilation error if the specified condition is false...">wxCOMPILE_TIME_ASSERT()</a> results in a compilation error if the specified <code>condition</code> is <span class="literal">false</span>. <a href="#gade23c9c38d065845dc040e31525befdc"></a><br/></td></tr>
<tr class="separator:gade23c9c38d065845dc040e31525befdc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf12b2bda7fcd1b1df041f426d245b17f"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#gaf12b2bda7fcd1b1df041f426d245b17f">wxCOMPILE_TIME_ASSERT2</a>(condition, message, name)</td></tr>
<tr class="memdesc:gaf12b2bda7fcd1b1df041f426d245b17f"><td class="mdescLeft"> </td><td class="mdescRight">This macro is identical to <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc" title="Using wxCOMPILE_TIME_ASSERT() results in a compilation error if the specified condition is false...">wxCOMPILE_TIME_ASSERT()</a> except that it allows you to specify a unique <code>name</code> for the struct internally defined by this macro to avoid getting the compilation errors described for <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc" title="Using wxCOMPILE_TIME_ASSERT() results in a compilation error if the specified condition is false...">wxCOMPILE_TIME_ASSERT()</a>. <a href="#gaf12b2bda7fcd1b1df041f426d245b17f"></a><br/></td></tr>
<tr class="separator:gaf12b2bda7fcd1b1df041f426d245b17f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga96e17e1bb37bec44a6608d0521abe22e"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga96e17e1bb37bec44a6608d0521abe22e">wxDISABLE_ASSERTS_IN_RELEASE_BUILD</a>()   <a class="el" href="group__group__funcmacro__debug.html#ga36a77b1afdfcac5d30beeb7c727b797c">wxDisableAsserts</a>()</td></tr>
<tr class="memdesc:ga96e17e1bb37bec44a6608d0521abe22e"><td class="mdescLeft"> </td><td class="mdescRight">Use this macro to disable asserts in release build when not using <a class="el" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP()</a>. <a href="#ga96e17e1bb37bec44a6608d0521abe22e"></a><br/></td></tr>
<tr class="separator:ga96e17e1bb37bec44a6608d0521abe22e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaa5b456751cd8c71e9a787fba16ecbd68"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#gaa5b456751cd8c71e9a787fba16ecbd68">wxFAIL</a></td></tr>
<tr class="memdesc:gaa5b456751cd8c71e9a787fba16ecbd68"><td class="mdescLeft"> </td><td class="mdescRight">Will always generate an assert error if this code is reached (in debug mode). <a href="#gaa5b456751cd8c71e9a787fba16ecbd68"></a><br/></td></tr>
<tr class="separator:gaa5b456751cd8c71e9a787fba16ecbd68"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4d129eca8fff062a65dec065edca085e"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga4d129eca8fff062a65dec065edca085e">wxFAIL_MSG</a>(message)</td></tr>
<tr class="memdesc:ga4d129eca8fff062a65dec065edca085e"><td class="mdescLeft"> </td><td class="mdescRight">Will always generate an assert error with specified message if this code is reached (in debug mode). <a href="#ga4d129eca8fff062a65dec065edca085e"></a><br/></td></tr>
<tr class="separator:ga4d129eca8fff062a65dec065edca085e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gac3ef2e94c74050aa3098ae22a49bf7c7"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#gac3ef2e94c74050aa3098ae22a49bf7c7">wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD</a>()</td></tr>
<tr class="memdesc:gac3ef2e94c74050aa3098ae22a49bf7c7"><td class="mdescLeft"> </td><td class="mdescRight">Use this macro to disable logging at debug and trace levels in release build when not using <a class="el" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP()</a>. <a href="#gac3ef2e94c74050aa3098ae22a49bf7c7"></a><br/></td></tr>
<tr class="separator:gac3ef2e94c74050aa3098ae22a49bf7c7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga217a048b9e879488505a8c44cb83cc0e"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga217a048b9e879488505a8c44cb83cc0e">WXDEBUG_NEW</a>(arg)</td></tr>
<tr class="memdesc:ga217a048b9e879488505a8c44cb83cc0e"><td class="mdescLeft"> </td><td class="mdescRight">This is defined in debug mode to be call the redefined new operator with filename and line number arguments. <a href="#ga217a048b9e879488505a8c44cb83cc0e"></a><br/></td></tr>
<tr class="separator:ga217a048b9e879488505a8c44cb83cc0e"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga5677dae639575c2d7e76edff69271fa9"><td class="memItemLeft" align="right" valign="top">typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga5677dae639575c2d7e76edff69271fa9">wxAssertHandler_t</a> )(const <a class="el" href="classwx_string.html">wxString</a> &file, int line, const <a class="el" href="classwx_string.html">wxString</a> &func, const <a class="el" href="classwx_string.html">wxString</a> &cond, const <a class="el" href="classwx_string.html">wxString</a> &msg)</td></tr>
<tr class="memdesc:ga5677dae639575c2d7e76edff69271fa9"><td class="mdescLeft"> </td><td class="mdescRight">Type for the function called in case of assert failure. <a href="#ga5677dae639575c2d7e76edff69271fa9"></a><br/></td></tr>
<tr class="separator:ga5677dae639575c2d7e76edff69271fa9"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga992a93c797d5777f5adc2353c35d4c47"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga992a93c797d5777f5adc2353c35d4c47">wxAbort</a> ()</td></tr>
<tr class="memdesc:ga992a93c797d5777f5adc2353c35d4c47"><td class="mdescLeft"> </td><td class="mdescRight">Exits the program immediately. <a href="#ga992a93c797d5777f5adc2353c35d4c47"></a><br/></td></tr>
<tr class="separator:ga992a93c797d5777f5adc2353c35d4c47"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga36a77b1afdfcac5d30beeb7c727b797c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga36a77b1afdfcac5d30beeb7c727b797c">wxDisableAsserts</a> ()</td></tr>
<tr class="memdesc:ga36a77b1afdfcac5d30beeb7c727b797c"><td class="mdescLeft"> </td><td class="mdescRight">Disable the condition checks in the assertions. <a href="#ga36a77b1afdfcac5d30beeb7c727b797c"></a><br/></td></tr>
<tr class="separator:ga36a77b1afdfcac5d30beeb7c727b797c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaeb7e13193cb75f59c70a40bdc595a545"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#gaeb7e13193cb75f59c70a40bdc595a545">wxIsDebuggerRunning</a> ()</td></tr>
<tr class="memdesc:gaeb7e13193cb75f59c70a40bdc595a545"><td class="mdescLeft"> </td><td class="mdescRight">Returns <span class="literal">true</span> if the program is running under debugger, <span class="literal">false</span> otherwise. <a href="#gaeb7e13193cb75f59c70a40bdc595a545"></a><br/></td></tr>
<tr class="separator:gaeb7e13193cb75f59c70a40bdc595a545"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga7a8443c97e45d2943f03769aaa787376"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__funcmacro__debug.html#ga5677dae639575c2d7e76edff69271fa9">wxAssertHandler_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga7a8443c97e45d2943f03769aaa787376">wxSetAssertHandler</a> (<a class="el" href="group__group__funcmacro__debug.html#ga5677dae639575c2d7e76edff69271fa9">wxAssertHandler_t</a> handler)</td></tr>
<tr class="memdesc:ga7a8443c97e45d2943f03769aaa787376"><td class="mdescLeft"> </td><td class="mdescRight">Sets the function to be called in case of assertion failure. <a href="#ga7a8443c97e45d2943f03769aaa787376"></a><br/></td></tr>
<tr class="separator:ga7a8443c97e45d2943f03769aaa787376"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga56835907381132cfc64135d7fbf9d883"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga56835907381132cfc64135d7fbf9d883">wxSetDefaultAssertHandler</a> ()</td></tr>
<tr class="memdesc:ga56835907381132cfc64135d7fbf9d883"><td class="mdescLeft"> </td><td class="mdescRight">Reset the assert handler to default function which shows a message box when an assert happens. <a href="#ga56835907381132cfc64135d7fbf9d883"></a><br/></td></tr>
<tr class="separator:ga56835907381132cfc64135d7fbf9d883"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga982e43add2be6c375904de61dcb9f852"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__funcmacro__debug.html#ga982e43add2be6c375904de61dcb9f852">wxTrap</a> ()</td></tr>
<tr class="memdesc:ga982e43add2be6c375904de61dcb9f852"><td class="mdescLeft"> </td><td class="mdescRight">Generate a debugger exception meaning that the control is passed to the debugger if one is attached to the process. <a href="#ga982e43add2be6c375904de61dcb9f852"></a><br/></td></tr>
<tr class="separator:ga982e43add2be6c375904de61dcb9f852"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ga30ad68c25d4f7a731f60eb07419c2960"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define __WXDEBUG__</td>
</tr>
</table>
</div><div class="memdoc">
<p>Compatibility macro indicating presence of debug support. </p>
<p>This symbol is defined if wxDEBUG_LEVEL is greater than 0 and undefined otherwise.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga204cc264ee560b67e6c6467ba8ffee5f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxASSERT</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition</td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Assert macro. </p>
<p>An error message will be generated if the condition is <span class="literal">false</span> in debug mode, but nothing will be done in the release build.</p>
<p>Please note that the condition in <a class="el" href="group__group__funcmacro__debug.html#ga204cc264ee560b67e6c6467ba8ffee5f" title="Assert macro.">wxASSERT()</a> should have no side effects because it will not be executed in release mode at all.</p>
<p>This macro should be used to catch (in debug builds) logical errors done by the programmer.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#ga0224638a009ef6a78e09c0d3bb61c379" title="Assert macro with message.">wxASSERT_MSG()</a>, <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc" title="Using wxCOMPILE_TIME_ASSERT() results in a compilation error if the specified condition is false...">wxCOMPILE_TIME_ASSERT()</a></dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga9ff90708a7b76e926493ac0860f6854c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxASSERT_LEVEL_2</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition</td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Assert macro for expensive run-time checks. </p>
<p>This macro does nothing unless wxDEBUG_LEVEL is 2 or more and is meant to be used for the assertions with noticeable performance impact and which, hence, should be disabled during run-time.</p>
<p>If wxDEBUG_LEVEL is 2 or more, it becomes the same as <a class="el" href="group__group__funcmacro__debug.html#ga204cc264ee560b67e6c6467ba8ffee5f" title="Assert macro.">wxASSERT()</a>.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="gaf924de21e1d2b51a97886367b99851e7"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxASSERT_LEVEL_2_MSG</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">msg </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Assert macro with a custom message for expensive run-time checks. </p>
<p>If wxDEBUG_LEVEL is 2 or more, this is the same as <a class="el" href="group__group__funcmacro__debug.html#ga0224638a009ef6a78e09c0d3bb61c379" title="Assert macro with message.">wxASSERT_MSG()</a>, otherwise it doesn't do anything at all.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#ga9ff90708a7b76e926493ac0860f6854c" title="Assert macro for expensive run-time checks.">wxASSERT_LEVEL_2()</a></dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="gabcdb0bf7c5499469b40a8fe8206e2cbf"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxASSERT_MIN_BITSIZE</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">type, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">size </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This macro results in a <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc">compile time assertion failure</a> if the size of the given <code>type</code> is less than <code>size</code> bits. </p>
<p>This macro should be used to catch (in debug builds) logical errors done by the programmer.</p>
<p>You may use it like this, for example:</p>
<div class="fragment"><div class="line"><span class="comment">// we rely on the int being able to hold values up to 2^32</span></div>
<div class="line"><a class="code" href="group__group__funcmacro__debug.html#gabcdb0bf7c5499469b40a8fe8206e2cbf" title="This macro results in a compile time assertion failure if the size of the given type is less than siz...">wxASSERT_MIN_BITSIZE</a>(<span class="keywordtype">int</span>, 32);</div>
<div class="line"></div>
<div class="line"><span class="comment">// can't work with the platforms using UTF-8 for wchar_t</span></div>
<div class="line"><a class="code" href="group__group__funcmacro__debug.html#gabcdb0bf7c5499469b40a8fe8206e2cbf" title="This macro results in a compile time assertion failure if the size of the given type is less than siz...">wxASSERT_MIN_BITSIZE</a>(<span class="keywordtype">wchar_t</span>, 16);</div>
</div><!-- fragment --><p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga0224638a009ef6a78e09c0d3bb61c379"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxASSERT_MSG</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">message </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Assert macro with message. </p>
<p>An error message will be generated if the condition is <span class="literal">false</span>.</p>
<p>This macro should be used to catch (in debug builds) logical errors done by the programmer.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#ga204cc264ee560b67e6c6467ba8ffee5f" title="Assert macro.">wxASSERT()</a>, <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc" title="Using wxCOMPILE_TIME_ASSERT() results in a compilation error if the specified condition is false...">wxCOMPILE_TIME_ASSERT()</a></dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="gacce4d688e56d4de1bbef692e7df2e3e3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxCHECK</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">retValue </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks that the condition is <span class="literal">true</span>, returns with the given return value if not (stops execution in debug mode). </p>
<p>This check is done even in release mode.</p>
<p>This macro should be used to catch (both in debug and release builds) logical errors done by the programmer.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga2a551ae1dcd439257d35a9b0b6ed483c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxCHECK2</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">operation </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks that the condition is <span class="literal">true</span>, and if not, it will <a class="el" href="group__group__funcmacro__debug.html#gaa5b456751cd8c71e9a787fba16ecbd68" title="Will always generate an assert error if this code is reached (in debug mode).">wxFAIL()</a> and execute the given <code>operation</code> if it is not. </p>
<p>This is a generalisation of <a class="el" href="group__group__funcmacro__debug.html#gacce4d688e56d4de1bbef692e7df2e3e3" title="Checks that the condition is true, returns with the given return value if not (stops execution in deb...">wxCHECK()</a> and may be used when something else than just returning from the function must be done when the <code>condition</code> is <span class="literal">false</span>. This check is done even in release mode.</p>
<p>This macro should be used to catch (both in debug and release builds) logical errors done by the programmer.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="gad9673fe2c9e69d6b41f0175b151060d0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxCHECK2_MSG</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">operation, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">message </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This is the same as <a class="el" href="group__group__funcmacro__debug.html#ga2a551ae1dcd439257d35a9b0b6ed483c" title="Checks that the condition is true, and if not, it will wxFAIL() and execute the given operation if it...">wxCHECK2()</a>, but <a class="el" href="group__group__funcmacro__debug.html#ga4d129eca8fff062a65dec065edca085e" title="Will always generate an assert error with specified message if this code is reached (in debug mode)...">wxFAIL_MSG()</a> with the specified <code>message</code> is called instead of <a class="el" href="group__group__funcmacro__debug.html#gaa5b456751cd8c71e9a787fba16ecbd68" title="Will always generate an assert error if this code is reached (in debug mode).">wxFAIL()</a> if the <code>condition</code> is <span class="literal">false</span>. </p>
<p>This macro should be used to catch (both in debug and release builds) logical errors done by the programmer.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga4822a2ea9fdd0bc98caa3ff42587743e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxCHECK_MSG</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">retValue, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">message </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks that the condition is <span class="literal">true</span>, returns with the given return value if not (stops execution in debug mode). </p>
<p>This check is done even in release mode.</p>
<p>This macro may be only used in non-void functions, see also <a class="el" href="group__group__funcmacro__debug.html#ga0cf2ca7d7ff0107197e51e6b434fd0bd" title="Checks that the condition is true, and returns if not (stops execution with the given error message i...">wxCHECK_RET()</a>.</p>
<p>This macro should be used to catch (both in debug and release builds) logical errors done by the programmer.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga0cf2ca7d7ff0107197e51e6b434fd0bd"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxCHECK_RET</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">message </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks that the condition is <span class="literal">true</span>, and returns if not (stops execution with the given error message in debug mode). </p>
<p>This check is done even in release mode.</p>
<p>This macro should be used in void functions instead of <a class="el" href="group__group__funcmacro__debug.html#ga4822a2ea9fdd0bc98caa3ff42587743e" title="Checks that the condition is true, returns with the given return value if not (stops execution in deb...">wxCHECK_MSG()</a>.</p>
<p>This macro should be used to catch (both in debug and release builds) logical errors done by the programmer.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="gade23c9c38d065845dc040e31525befdc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxCOMPILE_TIME_ASSERT</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">message </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Using <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc" title="Using wxCOMPILE_TIME_ASSERT() results in a compilation error if the specified condition is false...">wxCOMPILE_TIME_ASSERT()</a> results in a compilation error if the specified <code>condition</code> is <span class="literal">false</span>. </p>
<p>The compiler error message should include the <code>message</code> identifier - please note that it must be a valid C++ identifier and not a string unlike in the other cases.</p>
<p>This macro is mostly useful for testing the expressions involving the <code>sizeof</code> operator as they can't be tested by the preprocessor but it is sometimes desirable to test them at the compile time.</p>
<p>Note that this macro internally declares a struct whose name it tries to make unique by using the <code><b>LINE</b></code> in it but it may still not work if you use it on the same line in two different source files. In this case you may either change the line in which either of them appears on or use the <a class="el" href="group__group__funcmacro__debug.html#gaf12b2bda7fcd1b1df041f426d245b17f" title="This macro is identical to wxCOMPILE_TIME_ASSERT() except that it allows you to specify a unique name...">wxCOMPILE_TIME_ASSERT2()</a> macro.</p>
<p>Also note that Microsoft Visual C++ has a bug which results in compiler errors if you use this macro with 'Program Database For Edit And Continue' (<code>/ZI</code>) option, so you shouldn't use it ('Program Database' (<code>/Zi</code>) is ok though) for the code making use of this macro.</p>
<p>This macro should be used to catch misconfigurations at compile-time.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#ga0224638a009ef6a78e09c0d3bb61c379" title="Assert macro with message.">wxASSERT_MSG()</a>, <a class="el" href="group__group__funcmacro__debug.html#gabcdb0bf7c5499469b40a8fe8206e2cbf" title="This macro results in a compile time assertion failure if the size of the given type is less than siz...">wxASSERT_MIN_BITSIZE()</a></dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="gaf12b2bda7fcd1b1df041f426d245b17f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxCOMPILE_TIME_ASSERT2</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">message, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">name </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This macro is identical to <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc" title="Using wxCOMPILE_TIME_ASSERT() results in a compilation error if the specified condition is false...">wxCOMPILE_TIME_ASSERT()</a> except that it allows you to specify a unique <code>name</code> for the struct internally defined by this macro to avoid getting the compilation errors described for <a class="el" href="group__group__funcmacro__debug.html#gade23c9c38d065845dc040e31525befdc" title="Using wxCOMPILE_TIME_ASSERT() results in a compilation error if the specified condition is false...">wxCOMPILE_TIME_ASSERT()</a>. </p>
<p>This macro should be used to catch misconfigurations at compile-time.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga7ce424d27d39bb92c26c80b6a1903725"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxDEBUG_LEVEL</td>
</tr>
</table>
</div><div class="memdoc">
<p>Preprocessor symbol defining the level of debug support available. </p>
<p>This symbol is defined to 1 by default meaning that asserts are compiled in (although they may be disabled by a call to <a class="el" href="group__group__funcmacro__debug.html#ga36a77b1afdfcac5d30beeb7c727b797c" title="Disable the condition checks in the assertions.">wxDisableAsserts()</a>). You may predefine it as 0 prior to including any wxWidgets headers to omit the calls to <a class="el" href="group__group__funcmacro__debug.html#ga204cc264ee560b67e6c6467ba8ffee5f" title="Assert macro.">wxASSERT()</a> and related macros entirely in your own code and you may also predefine it as 0 when building wxWidgets to also avoid including any asserts in wxWidgets itself.</p>
<p>Alternatively, you may predefine it as 2 to include <a class="el" href="group__group__funcmacro__debug.html#ga9ff90708a7b76e926493ac0860f6854c" title="Assert macro for expensive run-time checks.">wxASSERT_LEVEL_2()</a> and similar macros which are used for asserts which have non-trivial run-time costs and so are disabled by default.</p>
<dl class="section since"><dt>Since</dt><dd>2.9.1</dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga217a048b9e879488505a8c44cb83cc0e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define WXDEBUG_NEW</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">arg</td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This is defined in debug mode to be call the redefined new operator with filename and line number arguments. </p>
<p>The definition is:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#define WXDEBUG_NEW new(__FILE__,__LINE__)</span></div>
</div><!-- fragment --><p>In non-debug mode, this is defined as the normal new operator.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/object.h> </pre>
</div>
</div>
<a class="anchor" id="ga96e17e1bb37bec44a6608d0521abe22e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxDISABLE_ASSERTS_IN_RELEASE_BUILD</td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td>   <a class="el" href="group__group__funcmacro__debug.html#ga36a77b1afdfcac5d30beeb7c727b797c">wxDisableAsserts</a>()</td>
</tr>
</table>
</div><div class="memdoc">
<p>Use this macro to disable asserts in release build when not using <a class="el" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP()</a>. </p>
<p>By default, assert message boxes are suppressed in release build by <a class="el" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP()</a> which uses this macro. If you don't use <a class="el" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP()</a> because your application initializes wxWidgets directly (e.g. calls <a class="el" href="group__group__funcmacro__appinitterm.html#ga7d3eefb35631a5d8dfce97eb17340b21" title="This function initializes wxWidgets in a platform-dependent way.">wxEntry()</a> or <a class="el" href="group__group__funcmacro__appinitterm.html#gac81f7fea72a17cc744d8c8785864c78a" title="This function can be used to perform the initialization of wxWidgets if you can't use the default ini...">wxEntryStart()</a> itself) but still want to suppress assert notifications in release build you need to use this macro directly.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#ga8db18cbe95b3b42c3017a8bf048b0839" title="Use this macro to disable all debugging code in release build when not using wxIMPLEMENT_APP().">wxDISABLE_DEBUG_SUPPORT()</a></dd></dl>
<dl class="section since"><dt>Since</dt><dd>2.9.1</dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="gac3ef2e94c74050aa3098ae22a49bf7c7"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD</td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Use this macro to disable logging at debug and trace levels in release build when not using <a class="el" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP()</a>. </p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#ga8db18cbe95b3b42c3017a8bf048b0839" title="Use this macro to disable all debugging code in release build when not using wxIMPLEMENT_APP().">wxDISABLE_DEBUG_SUPPORT()</a>, <a class="el" href="group__group__funcmacro__debug.html#ga96e17e1bb37bec44a6608d0521abe22e" title="Use this macro to disable asserts in release build when not using wxIMPLEMENT_APP().">wxDISABLE_ASSERTS_IN_RELEASE_BUILD()</a>, <a class="el" href="overview_debugging.html">Debugging</a></dd></dl>
<dl class="section since"><dt>Since</dt><dd>2.9.1</dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/log.h> </pre>
</div>
</div>
<a class="anchor" id="ga8db18cbe95b3b42c3017a8bf048b0839"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxDISABLE_DEBUG_SUPPORT</td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><a class="code" href="group__group__funcmacro__debug.html#ga96e17e1bb37bec44a6608d0521abe22e" title="Use this macro to disable asserts in release build when not using wxIMPLEMENT_APP().">wxDISABLE_ASSERTS_IN_RELEASE_BUILD</a>(); \</div>
<div class="line"> wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()</div>
</div><!-- fragment -->
<p>Use this macro to disable all debugging code in release build when not using <a class="el" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP()</a>. </p>
<p>Currently this macro disables assert checking and debug and trace level logging messages in release build (i.e. when <code>NDEBUG</code> is defined). It is used by <a class="el" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP()</a> macro so you only need to use it explicitly if you don't use this macro but initialize wxWidgets directly (e.g. calls <a class="el" href="group__group__funcmacro__appinitterm.html#ga7d3eefb35631a5d8dfce97eb17340b21" title="This function initializes wxWidgets in a platform-dependent way.">wxEntry()</a> or <a class="el" href="group__group__funcmacro__appinitterm.html#gac81f7fea72a17cc744d8c8785864c78a" title="This function can be used to perform the initialization of wxWidgets if you can't use the default ini...">wxEntryStart()</a> itself).</p>
<p>If you do not want to disable debugging code even in release build of your application, you can use <a class="el" href="group__group__funcmacro__debug.html#ga56835907381132cfc64135d7fbf9d883" title="Reset the assert handler to default function which shows a message box when an assert happens...">wxSetDefaultAssertHandler()</a> and <a class="el" href="classwx_log.html#a4ea68379469ca27f645d5f91c2d42b3b" title="Specifies that log messages with level greater (numerically) than logLevel should be ignored and not ...">wxLog::SetLogLevel()</a> with <code>wxLOG_Max</code> parameter to enable assertions and debug logging respectively.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#ga96e17e1bb37bec44a6608d0521abe22e" title="Use this macro to disable asserts in release build when not using wxIMPLEMENT_APP().">wxDISABLE_ASSERTS_IN_RELEASE_BUILD()</a>, <a class="el" href="group__group__funcmacro__debug.html#gac3ef2e94c74050aa3098ae22a49bf7c7" title="Use this macro to disable logging at debug and trace levels in release build when not using wxIMPLEME...">wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD()</a>, <a class="el" href="overview_debugging.html">Debugging</a></dd></dl>
<dl class="section since"><dt>Since</dt><dd>2.9.1</dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/app.h> </pre>
</div>
</div>
<a class="anchor" id="gaa5b456751cd8c71e9a787fba16ecbd68"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxFAIL</td>
</tr>
</table>
</div><div class="memdoc">
<p>Will always generate an assert error if this code is reached (in debug mode). </p>
<p>Note that you don't have to (and cannot) use brackets when invoking this macro:</p>
<div class="fragment"><div class="line"><span class="keywordflow">if</span> (...some condition...) {</div>
<div class="line"> <a class="code" href="group__group__funcmacro__debug.html#gaa5b456751cd8c71e9a787fba16ecbd68" title="Will always generate an assert error if this code is reached (in debug mode).">wxFAIL</a>;</div>
<div class="line">}</div>
</div><!-- fragment --><p>This macro should be used to catch (in debug builds) logical errors done by the programmer.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#ga4d129eca8fff062a65dec065edca085e" title="Will always generate an assert error with specified message if this code is reached (in debug mode)...">wxFAIL_MSG()</a></dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga4d129eca8fff062a65dec065edca085e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define wxFAIL_MSG</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">message</td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Will always generate an assert error with specified message if this code is reached (in debug mode). </p>
<p>This macro is useful for marking "unreachable" code areas, for example it may be used in the "default:" branch of a switch statement if all possible cases are processed above.</p>
<p>This macro should be used to catch (in debug builds) logical errors done by the programmer.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#gaa5b456751cd8c71e9a787fba16ecbd68" title="Will always generate an assert error if this code is reached (in debug mode).">wxFAIL()</a></dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="ga5677dae639575c2d7e76edff69271fa9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef void(* wxAssertHandler_t)(const <a class="el" href="classwx_string.html">wxString</a> &file, int line, const <a class="el" href="classwx_string.html">wxString</a> &func, const <a class="el" href="classwx_string.html">wxString</a> &cond, const <a class="el" href="classwx_string.html">wxString</a> &msg)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Type for the function called in case of assert failure. </p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__group__funcmacro__debug.html#ga7a8443c97e45d2943f03769aaa787376" title="Sets the function to be called in case of assertion failure.">wxSetAssertHandler()</a> </dd></dl>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga992a93c797d5777f5adc2353c35d4c47"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wxAbort </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Exits the program immediately. </p>
<p>This is a simple wrapper for the standard abort() function which is not available under all platforms (currently only Windows CE doesn't provide it).</p>
<dl class="section since"><dt>Since</dt><dd>2.9.4 </dd></dl>
</div>
</div>
<a class="anchor" id="ga36a77b1afdfcac5d30beeb7c727b797c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wxDisableAsserts </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Disable the condition checks in the assertions. </p>
<p>This is the same as calling <a class="el" href="group__group__funcmacro__debug.html#ga7a8443c97e45d2943f03769aaa787376" title="Sets the function to be called in case of assertion failure.">wxSetAssertHandler()</a> with <span class="literal">NULL</span> handler.</p>
<dl class="section since"><dt>Since</dt><dd>2.9.0</dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="gaeb7e13193cb75f59c70a40bdc595a545"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool wxIsDebuggerRunning </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns <span class="literal">true</span> if the program is running under debugger, <span class="literal">false</span> otherwise. </p>
<p>Please note that this function is currently only implemented for Win32 and always returns <span class="literal">false</span> elsewhere.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga7a8443c97e45d2943f03769aaa787376"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__group__funcmacro__debug.html#ga5677dae639575c2d7e76edff69271fa9">wxAssertHandler_t</a> wxSetAssertHandler </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__group__funcmacro__debug.html#ga5677dae639575c2d7e76edff69271fa9">wxAssertHandler_t</a> </td>
<td class="paramname"><em>handler</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the function to be called in case of assertion failure. </p>
<p>The default assert handler forwards to <a class="el" href="classwx_app_console.html#a5f91d78bbfe3c9ef28e8e3c8fdf29989" title="This function is called when an assert failure occurs, i.e. the condition specified in wxASSERT() mac...">wxApp::OnAssertFailure()</a> whose default behaviour is, in turn, to show the standard assertion failure dialog if a <a class="el" href="classwx_app.html" title="The wxApp class represents the application itself when wxUSE_GUI=1.">wxApp</a> object exists or shows the same dialog itself directly otherwise.</p>
<p>While usually it is enough – and more convenient – to just override OnAssertFailure(), to handle all assertion failures, including those occurring even before <a class="el" href="classwx_app.html" title="The wxApp class represents the application itself when wxUSE_GUI=1.">wxApp</a> object creation of after its destruction you need to provide your assertion handler function.</p>
<p>This function also provides a simple way to disable all asserts: simply pass <span class="literal">NULL</span> pointer to it. Doing this will result in not even evaluating assert conditions at all, avoiding almost all run-time cost of asserts.</p>
<p>Notice that this function is not MT-safe, so you should call it before starting any other threads.</p>
<p>The return value of this function is the previous assertion handler. It can be called after any pre-processing by your handler and can also be restored later if you uninstall your handler.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">handler</td><td>The function to call in case of assertion failure or <span class="literal">NULL</span>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The previous assert handler which is not <span class="literal">NULL</span> by default but could be <span class="literal">NULL</span> if it had been previously set to this value using this function.</dd></dl>
<dl class="section since"><dt>Since</dt><dd>2.9.0</dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga56835907381132cfc64135d7fbf9d883"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wxSetDefaultAssertHandler </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reset the assert handler to default function which shows a message box when an assert happens. </p>
<p>This can be useful for the applications compiled in release build (with <code>NDEBUG</code> defined) for which the asserts are by default disabled: if you wish to enable them even in this case you need to call this function.</p>
<dl class="section since"><dt>Since</dt><dd>2.9.1</dd></dl>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
<a class="anchor" id="ga982e43add2be6c375904de61dcb9f852"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void wxTrap </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Generate a debugger exception meaning that the control is passed to the debugger if one is attached to the process. </p>
<p>Otherwise the program just terminates abnormally.</p>
<p>If <code>wxDEBUG_LEVEL</code> is 0 (which is not the default) this function does nothing.</p>
<p>Include file: </p>
<pre class="fragment">#include <wx/debug.h> </pre>
</div>
</div>
</div><!-- contents -->
<address class="footer">
<small>
Generated on Thu Nov 27 2014 13:46:43 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>
|