From Jason Turner

[dcl.attr.unused]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpw1atocur/{from.md → to.md} +33 -0
tmp/tmpw1atocur/{from.md → to.md} RENAMED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Maybe unused attribute <a id="dcl.attr.unused">[[dcl.attr.unused]]</a>
2
+
3
+ The *attribute-token* `maybe_unused` indicates that a name or entity is
4
+ possibly intentionally unused. It shall appear at most once in each
5
+ *attribute-list* and no *attribute-argument-clause* shall be present.
6
+
7
+ The attribute may be applied to the declaration of a class, a
8
+ *typedef-name*, a variable, a non-static data member, a function, an
9
+ enumeration, or an enumerator.
10
+
11
+ [*Note 1*: For an entity marked `maybe_unused`, implementations are
12
+ encouraged not to emit a warning that the entity is unused, or that the
13
+ entity is used despite the presence of the attribute. — *end note*]
14
+
15
+ A name or entity declared without the `maybe_unused` attribute can later
16
+ be redeclared with the attribute and vice versa. An entity is considered
17
+ marked after the first declaration that marks it.
18
+
19
+ [*Example 1*:
20
+
21
+ ``` cpp
22
+ [[maybe_unused]] void f([[maybe_unused]] bool thing1,
23
+ [[maybe_unused]] bool thing2) {
24
+ [[maybe_unused]] bool b = thing1 && thing2;
25
+ assert(b);
26
+ }
27
+ ```
28
+
29
+ Implementations are encouraged not to warn that `b` is unused, whether
30
+ or not `NDEBUG` is defined.
31
+
32
+ — *end example*]
33
+