Skip to content

Commit cf05d9a

Browse files
committed
Document STATIC_ASSERT(DECL|STMT)
I think these are useful and stable enough to make public
1 parent 005db81 commit cf05d9a

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

perl.h

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4250,17 +4250,27 @@ hint to the compiler that this condition is likely to be false.
42504250
/* placeholder */
42514251
#endif
42524252

4253-
/* STATIC_ASSERT_DECL/STATIC_ASSERT_STMT are like assert(), but for compile
4254-
time invariants. That is, their argument must be a constant expression that
4255-
can be verified by the compiler. This expression can contain anything that's
4256-
known to the compiler, e.g. #define constants, enums, or sizeof (...). If
4257-
the expression evaluates to 0, compilation fails.
4258-
Because they generate no runtime code (i.e. their use is "free"), they're
4259-
always active, even under non-DEBUGGING builds.
4260-
STATIC_ASSERT_DECL expands to a declaration and is suitable for use at
4261-
file scope (outside of any function).
4262-
STATIC_ASSERT_STMT expands to a statement and is suitable for use inside a
4263-
function.
4253+
/*
4254+
=for apidoc Am||STATIC_ASSERT_DECL|const_expr
4255+
=for apidoc_item STATIC_ASSERT_STMT
4256+
4257+
These are like assert(), but for compile time invariants. That is, their
4258+
argument must be a constant expression that can be verified by the compiler.
4259+
This expression can contain anything that's known to the compiler, e.g. #define
4260+
constants, enums, or sizeof (...). If the expression evaluates to 0,
4261+
compilation fails.
4262+
4263+
Because they generate no runtime code (i.e. their use is "free"), they're
4264+
always active, even under non-DEBUGGING builds.
4265+
4266+
C<STATIC_ASSERT_STMT> expands to a statement and is suitable for use inside a
4267+
function.
4268+
4269+
C<STATIC_ASSERT_DECL> expands to a declaration and is suitable for use inside a
4270+
function or at file scope (outside of any function).
4271+
4272+
=cut
4273+
42644274
*/
42654275
#if (! defined(__IBMC__) || __IBMC__ >= 1210) \
42664276
&& (( defined(static_assert) && ( defined(_ISOC11_SOURCE) \

0 commit comments

Comments
 (0)