summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorLukas Mai <l.mai@web.de>2015-02-13 11:07:38 +0100
committerLukas Mai <l.mai@web.de>2015-02-13 11:07:38 +0100
commit5074d4c567c632ecf22733b0a13d7fcec4a73037 (patch)
tree2ca305858be3e48b52e3a6f5a262eb177c9c3faa /perl.h
parent31c916d28f0179fb2b0458e871263c606181b025 (diff)
downloadperl-5074d4c567c632ecf22733b0a13d7fcec4a73037.tar.gz
add a comment documenting STATIC_ASSERT_GLOBAL/STATIC_ASSERT_STMT
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/perl.h b/perl.h
index b6dbf61ea1..9976f86bdd 100644
--- a/perl.h
+++ b/perl.h
@@ -3510,6 +3510,18 @@ typedef pthread_key_t perl_key;
/* placeholder */
#endif
+/* STATIC_ASSERT_GLOBAL/STATIC_ASSERT_STMT are like assert(), but for compile
+ time invariants. That is, their argument must be a constant expression that
+ can be verified by the compiler. This expression can contain anything that's
+ known to the compiler, e.g. #define constants, enums, or sizeof (...). If
+ the expression evaluates to 0, compilation fails.
+ Because they generate no runtime code (i.e. their use is "free"), they're
+ always active, even under non-DEBUGGING builds.
+ STATIC_ASSERT_GLOBAL expands to a declaration and is suitable for use at
+ file scope (outside of any function).
+ STATIC_ASSERT_STMT expands to a statement and is suitable for use inside a
+ function.
+*/
#if (defined(static_assert) || (defined(__cplusplus) && __cplusplus >= 201103L)) && (!defined(__IBMC__) || __IBMC__ >= 1210)
/* static_assert is a macro defined in <assert.h> in C11 or a compiler
builtin in C++11.