pr_static_assert.rst (934B)
1 PR_STATIC_ASSERT 2 ================ 3 4 Prevents code from compiling when an expression has the value ``FALSE`` 5 at compile time. 6 7 8 Syntax 9 ------ 10 11 .. code:: 12 13 #include <prlog.h> 14 15 PR_STATIC_ASSERT ( expression ); 16 17 18 Parameters 19 ~~~~~~~~~~ 20 21 The macro has this parameter: 22 23 expression 24 Any valid expression which evaluates at compile-time to ``TRUE`` or 25 ``FALSE``. An expression which cannot be evaluated at compile time 26 will cause a compiler error; see :ref:`PR_ASSERT` for a runtime 27 alternative. 28 29 30 Returns 31 ~~~~~~~ 32 33 Nothing 34 35 36 Description 37 ----------- 38 39 This macro evaluates the specified expression. When the result is zero 40 (``FALSE``) program compilation will fail with a compiler error; 41 otherwise compilation completes successfully. The compiler error will 42 include the number of the line for which the compile-time assertion 43 failed. 44 45 This macro may only be used in locations where an ``extern`` function 46 declaration may be used.