diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2022-09-11 15:39:48 -0500 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2022-09-11 15:54:16 -0500 |
commit | e0e5ec8af025bf72ec5cddcaed79b4556e6c93b3 (patch) | |
tree | b1fc92d741b5fd79b000cd3910445174fd9f6b41 /doc | |
parent | b8344e1bbb017227cdb3c666295317a849dac617 (diff) | |
download | gnulib-e0e5ec8af025bf72ec5cddcaed79b4556e6c93b3.tar.gz |
verify: port better to C23
* lib/verify.h (_GL_VERIFY, static_assert):
If C23, use static_assert keyword; no macro.
This should simplify diagnostics and debugging.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/verify.texi | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/doc/verify.texi b/doc/verify.texi index dee6fa1cb1..e4037adda1 100644 --- a/doc/verify.texi +++ b/doc/verify.texi @@ -51,17 +51,14 @@ integer constant expression, then a compiler might reject a usage like @samp{verify (@var{V});} even when @var{V} is nonzero. -Although the standard @code{assert} macro is a runtime test, C2x -specifies a builtin @code{_Static_assert (@var{V})}, -its @file{assert.h} header has a similar macro -named @code{static_assert}, and C++17 has a similar -@code{static_assert} builtin. These builtins and macros differ -from @code{verify} in two major ways. First, they can also be used +Although the standard @code{assert} macro is a runtime test, C23 and C++17 +specify a builtin @code{static_assert (@var{V})}, which differs +from @code{verify} in two major ways. First, it can also be used within a @code{struct} or @code{union} specifier, in place of an -ordinary member declaration. Second, they allow the programmer to +ordinary member declaration. Second, it allows the programmer to specify, as an optional second argument, a compile-time diagnostic as a string literal. If your program is not intended to be portable to -compilers that lack C2x or C++17 @code{static_assert}, the only +compilers that lack C23 or C++17 @code{static_assert}, the only advantage of @code{verify} is that its name is a bit shorter. The @file{verify.h} header defines one more macro, @code{assume |