rspec/rules/S1669/cfamily/rule.adoc

41 lines
890 B
Plaintext
Raw Normal View History

== Why is this an issue?
The {cpp} standards define some identifiers as having special meaning in specific contexts. These are:
* ``++final++`` and ``++override++`` since {cpp}11
* ``++module++`` and ``++import++`` since {cpp}20
While it is technically possible to use them as normal identifiers, it's clearer for the reader of the code to consider them as if they were keywords, and only use them with their special meaning.
2020-06-30 12:47:33 +02:00
=== Noncompliant code example
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2020-06-30 12:47:33 +02:00
----
void module(int final); // Noncompliant
2020-06-30 12:47:33 +02:00
----
=== Compliant solution
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2020-06-30 12:47:33 +02:00
----
void precept(int finalValue); // Compliant
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Replace XXX with another name
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]