
Co-authored-by: Marco Borgeaud <89914223+marco-antognini-sonarsource@users.noreply.github.com>
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
The way an ``++#include++`` directive finds an actual file is implementation-defined, and in practice, it slightly differs in different systems.
|
|
|
|
Therefore, a good practice is to identify the files to include in the most straightforward way possible to reduce the risk of inconsistent behaviors.
|
|
|
|
This rule raises an issue when:
|
|
|
|
* The case of the file in the ``++#include++`` directive does not match the case of the file on the disk (the inclusion would not work on a case-sensitive OS),
|
|
* The file name in the ``++#include++`` directive contains trailing spaces (they would be ignored on Windows but considered on Unix).
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,cpp]
|
|
----
|
|
#include "Foo.h" // Noncompliant if the actual file name is "foo.h"
|
|
#include "bar.h " // Noncompliant, trailing space
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Change this path so that it matches the exact file name: "{actual path name}".
|
|
|
|
|
|
=== Highlighting
|
|
|
|
The path
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|