From WikiChip
Editing c/assert.h/static assert
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | {{ | + | {{DISPLAYTITLE: static_assert macro - <assert.h> - C}} |
− | The '''static_assert''' macro, which is part of | + | {{Assert.h - C}} |
+ | The '''static_assert''' macro, which is part of <[[assert.h - C|assert.h]]>, is a convenient object-like macro name that expands to the '''[[_Static_assert - C|_Static_assert]]''' keyword. | ||
+ | |||
+ | I.E., | ||
− | |||
<source lang="c">#include <assert.h> | <source lang="c">#include <assert.h> | ||
#define static_assert _Static_assert</source> | #define static_assert _Static_assert</source> | ||
== Description == | == Description == | ||
− | The static_assert object-like macro expands to the | + | The static_assert object-like macro expands to the [[_Static_assert - C|_Static_assert]], a keyword added in [[C11]] to provide compile-time assertion. |
== Example == | == Example == | ||
Line 24: | Line 26: | ||
<pre>example.c:3:1: error: static assertion failed "Code relies on int being exactly 4 bytes"</pre> | <pre>example.c:3:1: error: static assertion failed "Code relies on int being exactly 4 bytes"</pre> | ||
− | {{DEFAULTSORT:static_assert}} | + | {{DEFAULTSORT:static_assert - assert.h - C}} |
+ | [[Category:C standard library]] | ||
[[Category:assert.h - C]] | [[Category:assert.h - C]] | ||
− |