Next: complex.h, Previous: arpa/inet.h, Up: ISO C and POSIX Header File Substitutes [Contents][Index]
POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html
Gnulib module: assert-h
See also the Gnulib modules assert
and verify
.
Portability problems fixed by Gnulib:
<assert.h>
must be included before using
static_assert
. For example, GCC versions before 13 do not
support the static_assert
keyword that was standardized by C23.
static_assert
does not allow the second
string-literal argument to be omitted. For example, GCC versions
before 9.1 do not support the single-argument static_assert
that was standardized by C23 and C++17.
static_assert
at all.
For example, GCC versions before 4.6 and G++ versions before 4.3
do not support the two-argument form, which was standardized
by C11 and C++11.
_Static_assert
keyword or macro.
This portability problem should not matter with code using this
module, as such code should use static_assert
instead.
Portability problems not fixed by Gnulib:
static_assert
can also
be used within a struct
or 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
in code intended to be portable to C99 or earlier.
static_assert
is a keyword.
In C11 and C17 it is a macro. Any Gnulib substitute is also a macro.
assert
can be applied to any scalar expression.
In C89, the argument to assert
is of type int
.
Next: complex.h, Previous: arpa/inet.h, Up: ISO C and POSIX Header File Substitutes [Contents][Index]