assert.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <html>
  2. <head>
  3. <title>BOOST_PP_ASSERT</title>
  4. <link rel="stylesheet" type="text/css" href="../styles.css">
  5. </head>
  6. <body>
  7. <div style="margin-left: 0px;">
  8. The <b>BOOST_PP_ASSERT</b> macro conditionally causes a preprocessing error.
  9. </div>
  10. <h4>Usage</h4>
  11. <div class="code">
  12. <b>BOOST_PP_ASSERT</b>(<i>cond</i>)
  13. </div>
  14. <h4>Arguments</h4>
  15. <dl>
  16. <dt>cond</dt>
  17. <dd>
  18. A condition that determines whether an assertion occurs.&nbsp;
  19. Valid values range from <i>0</i> to <b>BOOST_PP_LIMIT_MAG</b>.
  20. </dd>
  21. </dl>
  22. <h4>Remarks</h4>
  23. <div>
  24. If <i>cond</i> expands to <i>0</i>, this macro causes a preprocessing error.&nbsp;
  25. Otherwise, it expands to nothing.
  26. </div>
  27. <h4>See Also</h4>
  28. <ul>
  29. <li><a href="assert_msg.html">BOOST_PP_ASSERT_MSG</a></li>
  30. <li><a href="limit_mag.html">BOOST_PP_LIMIT_MAG</a></li>
  31. </ul>
  32. <h4>Requirements</h4>
  33. <div>
  34. <b>Header:</b> &nbsp;<a href="../headers/debug/assert.html">&lt;boost/preprocessor/debug/assert.hpp&gt;</a>
  35. </div>
  36. <h4>Sample Code</h4>
  37. <div><pre>
  38. #include &lt;<a href="../headers/cat.html">boost/preprocessor/cat.hpp</a>&gt;
  39. #include &lt;<a href="../headers/debug/assert.html">boost/preprocessor/debug/assert.hpp</a>&gt;
  40. #include &lt;<a href="../headers/logical/bitnor.html">boost/preprocessor/logical/bitnor.hpp</a>&gt;
  41. #include &lt;<a href="../headers/logical/compl.html">boost/preprocessor/logical/compl.hpp</a>&gt;
  42. // The is BOOST_PP_IS_NULLARY macro is not part of
  43. // the public interface of the library because it
  44. // doesn't work on Borland preprocessors. It is
  45. // only used here to illustrate assertions. In
  46. // effect, it detects whether an argument is empty
  47. // parenthesis or some text.
  48. #include &lt;boost/preprocessor/detail/is_nullary.hpp&gt;
  49. #define IS_EDISON_DESIGN_GROUP() \
  50. <a href="compl.html">BOOST_PP_COMPL</a>( \
  51. BOOST_PP_IS_NULLARY( \
  52. <a href="cat.html">BOOST_PP_CAT</a>(IS_EDG_CHECK, __EDG_VERSION) \
  53. ) \
  54. ) \
  55. /**/
  56. #define IS_EDG_CHECK__EDG_VERSION ()
  57. #define IS_METROWERKS() \
  58. <a href="compl.html">BOOST_PP_COMPL</a>( \
  59. BOOST_PP_IS_NULLARY( \
  60. <a href="cat.html">BOOST_PP_CAT</a>(IS_MWERKS_CHECK, __MWERKS__) \
  61. ) \
  62. ) \
  63. /**/
  64. #define IS_MWERKS_CHECK__MWERKS__ ()
  65. #define IS_MICROSOFT() \
  66. <a href="bitnor.html">BOOST_PP_BITNOR</a>( \
  67. IS_MICROSOFT_ROOT(), \
  68. IS_EDISON_DESIGN_GROUP() \
  69. ) \
  70. /**/
  71. #define IS_MICROSOFT_ROOT() \
  72. BOOST_PP_IS_NULLARY( \
  73. <a href="cat.html">BOOST_PP_CAT</a>(IS_MSVC_CHECK, _MSC_VER) \
  74. ) \
  75. /**/
  76. #define IS_MSVC_CHECK_MS_VER ()
  77. // this macro doesn't work on EDG...
  78. // (this is just an example)
  79. #define MACRO(n) \
  80. <a href="cat.html">BOOST_PP_CAT</a>( \
  81. MACRO_, \
  82. IS_EDISON_DESIGN_GROUP() \
  83. )(n) \
  84. /**/
  85. #define MACRO_1(n) \
  86. <a href="assert.html">BOOST_PP_ASSERT</a>(0) \
  87. "Edison Design Group is not supported" \
  88. /**/
  89. #define MACRO_0(n) normal mode: n
  90. MACRO(10)
  91. </pre></div>
  92. <hr size="1">
  93. <div style="margin-left: 0px;">
  94. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  95. </br><i>© Copyright Paul Mensonides 2002</i>
  96. </div>
  97. <div style="margin-left: 0px;">
  98. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  99. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  100. copy at <a href=
  101. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  102. </div>
  103. </body>
  104. </html>