diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/c/language%2Fattributes%2Fmaybe_unused.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/c/language%2Fattributes%2Fmaybe_unused.html')
| -rw-r--r-- | devdocs/c/language%2Fattributes%2Fmaybe_unused.html | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/devdocs/c/language%2Fattributes%2Fmaybe_unused.html b/devdocs/c/language%2Fattributes%2Fmaybe_unused.html deleted file mode 100644 index e8af27c7..00000000 --- a/devdocs/c/language%2Fattributes%2Fmaybe_unused.html +++ /dev/null @@ -1,33 +0,0 @@ - <h1 id="firstHeading" class="firstHeading">C attribute: maybe_unused <span class="t-mark-rev t-since-c23">(since C23)</span> -</h1> <p>Suppresses warnings on unused entities.</p> -<h3 id="Syntax"> Syntax</h3> <table class="t-sdsc-begin"> <tr class="t-sdsc"> <td class="t-sdsc-nopad"> <code>[[</code> <code>maybe_unused</code> <code>]]</code><br><code>[[</code> <code>__maybe_unused__</code> <code>]]</code> </td> <td class="t-sdsc-nopad"> </td> <td class="t-sdsc-nopad"> </td> -</tr> -</table> <h3 id="Explanation"> Explanation</h3> <p>This attribute can appear in the declaration of the following entities:</p> -<ul> -<li> <a href="../struct" title="c/language/struct">struct</a>/<a href="../union" title="c/language/union">union</a>: <code>struct [[maybe_unused]] S;</code>, </li> -<li> <a href="../typedef" title="c/language/typedef">typedef name</a>: <code>[[maybe_unused]] typedef S* PS;</code>, </li> -<li> object: <code>[[maybe_unused]] int x;</code>, </li> -<li> struct/union member: <code>union U { [[maybe_unused]] int n; };</code>, </li> -<li> <a href="../function_definition" title="c/language/function definition">function</a>: <code>[[maybe_unused]] void f(void);</code>, </li> -<li> <a href="../enum" title="c/language/enum">enumeration</a>: <code>enum [[maybe_unused]] E {};</code>, </li> -<li> enumerator: <code>enum { A [[maybe_unused]], B [[maybe_unused]] = 42 };</code>. </li> -</ul> <p>If the compiler issues warnings on unused entities, that warning is suppressed for any entity declared <code>maybe_unused</code>.</p> -<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <assert.h> - -[[maybe_unused]] void f([[maybe_unused]] _Bool cond1, [[maybe_unused]] _Bool cond2) -{ - [[maybe_unused]] _Bool b = cond1 && cond2; - assert(b); // in release mode, assert is compiled out, and b is unused - // no warning because it is declared [[maybe_unused]] -} // parameters cond1 and cond2 are not used, no warning - -int main(void) -{ - f(1, 1); -}</pre></div> </div> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/language/attributes/maybe_unused" title="cpp/language/attributes/maybe unused">C++ documentation</a></span> for <code>maybe_unused</code> </td> -</tr> </table> <div class="_attribution"> - <p class="_attribution-p"> - © cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br> - <a href="https://en.cppreference.com/w/c/language/attributes/maybe_unused" class="_attribution-link">https://en.cppreference.com/w/c/language/attributes/maybe_unused</a> - </p> -</div> |
