Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110097521
D29833.id87716.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D29833.id87716.diff
View Options
Index: share/man/man3/assert.3
===================================================================
--- share/man/man3/assert.3
+++ share/man/man3/assert.3
@@ -28,15 +28,18 @@
.\" @(#)assert.3 8.1 (Berkeley) 6/9/93
.\" $FreeBSD$
.\"
-.Dd May 31, 2018
+.Dd April 19, 2021
.Dt ASSERT 3
.Os
.Sh NAME
-.Nm assert
+.Nm assert ,
+.Nm static_assert
.Nd expression verification macro
.Sh SYNOPSIS
.In assert.h
.Fn assert expression
+.Fn static_assert expression
+.Fn static_assert expression message
.Sh DESCRIPTION
The
.Fn assert
@@ -81,6 +84,21 @@
macro should only be used for ensuring the developer's expectations
hold true.
It is not appropriate for regular run-time error detection.
+.Pp
+The
+.Fn static_assert
+macro expands to
+.Fn _Static_assert ,
+and contrarily to
+.Fn assert ,
+makes assertions at compile-time.
+Once the constraint is violated, the compiler produces a diagnostic
+message including the string literal message, if provided.
+The initial form of the
+.Fn _Static_assert
+containing a string literal message was introduced in C11 standard, and
+the other form with no string literal is to be implemented by C2x and
+some compiler may lack its adoption at present.
.Sh EXAMPLES
The assertion:
.Dl "assert(1 == 0);"
@@ -99,10 +117,19 @@
.Xr abort2 2 ,
.Xr abort 3
.Sh STANDARDS
+.Rs
The
.Fn assert
macro conforms to
.St -isoC-99 .
+.Re
+.Pp
+.Rs
+The
+.Fn static_assert
+macro conforms to
+.St -isoC-2011 .
+.Re
.Sh HISTORY
An
.Nm
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 14, 2:17 PM (20 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16643595
Default Alt Text
D29833.id87716.diff (1 KB)
Attached To
Mode
D29833: assert(3): Update with _Static_assert
Attached
Detach File
Event Timeline
Log In to Comment