diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-05-05 22:43:18 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-05-05 22:43:18 -0700 |
commit | 8b401988f8558104b56c0ee36a4e75b1230ad371 (patch) | |
tree | 528c8036e71fc9b4bcaf168f95842b489630e51f /doc/posix-headers/assert.texi | |
parent | 864eeee51daf303bb48df9fcd64b59ea96b51c0e (diff) | |
download | gnulib-8b401988f8558104b56c0ee36a4e75b1230ad371.tar.gz |
assert-h: new module, which supports C1X-style static_assert
* lib/assert.in.h, m4/assert_h.m4, modules/assert-h: New files.
* lib/verify.h: Revamp so that this can be copied into assert.h,
while retaining the ability to use it standalone as before.
Rename private identifiers so as not to encroach on the
standard C namespace, since this is now used by assert.h.
(_GL_VERIFY_TYPE): New macro, factoring out differing parts of
the old verify_true.
(_GL_VERIFY_TRUE): New macro, with much of the contents of
the old verify_true. Use _GL_VERIFY_TYPE.
(_GL_VERIFY): New macro, with much of the contents of the old verify.
(static_assert): New macro, if _GL_STATIC_ASSERT_H
is defined and static_assert is not; _GL_STATIC_ASSERT_H is
defined when this file is copied into the replacement assert.h.
(_Static_assert): New macro, if _GL_STATIC_ASSERT_H is defined
and _Static_assert is not built in.
(verify_true, verify): Define only if _GL_STATIC_ASSERT_H is not
defined, and use the new macros mentioned above.
* doc/posix-headers/assert.texi: Document this.
Diffstat (limited to 'doc/posix-headers/assert.texi')
-rw-r--r-- | doc/posix-headers/assert.texi | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/doc/posix-headers/assert.texi b/doc/posix-headers/assert.texi index 02a1c3b547..aa78ee7bc5 100644 --- a/doc/posix-headers/assert.texi +++ b/doc/posix-headers/assert.texi @@ -3,12 +3,31 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html} -Gnulib module: --- +Gnulib module: assert-h + +See also the Gnulib module @code{assert}. Portability problems fixed by Gnulib: @itemize +@item +The draft C1X and C++0X @code{static_assert}, and the draft C1X +@code{_Static_assert}, are not supported by many platforms. +For example, GCC versions before 4.6.0 do not support @code{_Static_assert}, +and G++ versions through at least 4.6.0 do not support @code{static_assert}. @end itemize Portability problems not fixed by Gnulib: @itemize +@item +Draft C1X @code{_Static_assert} and draft C++0X @code{static_assert} +are keywords that can be used without including @code{<assert.h>}. +The Gnulib substitutes are macros that require including @code{<assert.h>}. +@item +The draft C1X @code{static_assert} and @code{_Static_assert} can also +be used within a @code{struct} or @code{union} specifier, in place of +an ordinary declaration of a member of the struct or union. The +Gnulib substitute can be used only as an ordinary declaration. +@item +In C99, @code{assert} can be applied to any scalar expression. +In C89, the argument to @code{assert} is of type @code{int}. @end itemize |