CPP-6230 Modify rule S1172: Mention new exceptional options introduced in C23 (#4750)
This commit is contained in:
parent
a4428806a8
commit
a9fc281e99
@ -6,6 +6,8 @@ include::../description.adoc[]
|
||||
|
||||
There are some cases when you want to have an unused parameter (usually because the function has to conform to a fixed prototype, or because it is virtual, or it will be called from a template). In this case, and if the parameter is never used, an accepted practice is to leave it unnamed. If it is only sometimes used (for instance, depending on conditional compilation), you may, since {cpp}17, use the ``\[[maybe_unused]]`` attribute to be explicit about it.
|
||||
|
||||
In case of C, since C23 you can also leave the parameter unnamed if it is never used, or use the `\[[maybe_unused]]` attribute if it is only used sometimes.
|
||||
|
||||
[source,cpp]
|
||||
----
|
||||
void f([[maybe_unused]] int i) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user