Skip to content

Commit e67ed1a

Browse files
committed
assert.3: Update as per C23
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
1 parent 5d9f55d commit e67ed1a

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

share/man/man3/assert.3

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2626
.\" SUCH DAMAGE.
2727
.\"
28-
.Dd April 20, 2021
28+
.Dd May 17, 2026
2929
.Dt ASSERT 3
3030
.Os
3131
.Sh NAME
@@ -76,13 +76,17 @@ is defined determines the behavior of assert from that point forward
7676
until the end of the unit or another include of
7777
.In assert.h .
7878
.Pp
79+
In C23 and later, the
80+
.Fn assert
81+
uses ellipsis as the parameter.
82+
.Pp
7983
The
8084
.Fn assert
8185
macro should only be used for ensuring the developer's expectations
8286
hold true.
8387
It is not appropriate for regular run-time error detection.
8488
.Pp
85-
The
89+
In pre-C23 compilation modes, the
8690
.Fn static_assert
8791
macro expands to
8892
.Fn _Static_assert ,
@@ -96,6 +100,13 @@ The initial form of the
96100
containing a string literal message was introduced in C11 standard, and
97101
the other form with no string literal is to be implemented by C2x and
98102
some compilers may lack its adoption at present.
103+
.Pp
104+
In C23 and later,
105+
.Fn static_assert
106+
is a language keyword, and
107+
.Fn _Static_assert
108+
is provided as an obsolescent alternative spelling that should not be
109+
used for new code and development..
99110
.Sh EXAMPLES
100111
The assertion:
101112
.Dl "assert(1 == 0);"
@@ -123,12 +134,18 @@ If none is provided, it only points at the constraint.
123134
The
124135
.Fn assert
125136
macro conforms to
126-
.St -isoC-99 .
137+
.St -isoC-99
138+
and
139+
.St -isoC-2023 ,
140+
depending on the compilation mode.
127141
.Pp
128142
The
129143
.Fn static_assert
130-
macro conforms to
131-
.St -isoC-2011 .
144+
conforms to
145+
.St -isoC-2011 ,
146+
wherein defined as a macro, and
147+
.St -isoC-2023 ,
148+
as a language keyword, depending on the compilation mode.
132149
.Sh HISTORY
133150
An
134151
.Nm

0 commit comments

Comments
 (0)