rspec/rules/S1669/cfamily/rule.adoc

49 lines
1.2 KiB
Plaintext

== 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.
=== Noncompliant code example
[source,cpp]
----
void module(int final); // Noncompliant
----
=== Compliant solution
[source,cpp]
----
void precept(int finalValue); // Compliant
----
== Resources
* {cpp} reference - https://en.cppreference.com/w/cpp/language/final[final specifier]
* {cpp} reference - https://en.cppreference.com/w/cpp/language/override[override specifier]
* {cpp} reference - https://en.cppreference.com/w/cpp/keyword/module[{cpp} keyword: module]
* {cpp} reference - https://en.cppreference.com/w/cpp/keyword/import[{cpp} keyword: import]
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[]