rspec/rules/S5978/cfamily/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

32 lines
842 B
Plaintext

== Why is this an issue?
Multicharacter literals have ``++int++`` type and have an implementation-defined value. This means they might be interpreted differently by different compilers. For example, they might lead to different behavior when compiled with GCC than when compiled with MSVC.
Even if they work as you expect with a specific compiler, they will make your code less portable. They are also misleading as they look like strings, hence make your code less readable.
=== Noncompliant code example
[source,cpp]
----
void f(int i) {
// ...
if (i == 'abcd') { // Noncompliant
// ...
}
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Do not use multicharacter literals, they have implementation-defined value.
endif::env-github,rspecator-view[]