
Co-authored-by: Marco Borgeaud <89914223+marco-antognini-sonarsource@users.noreply.github.com>
38 lines
1.4 KiB
Plaintext
38 lines
1.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
The ``++#include++`` directive is a preprocessor directive that tells the compiler to insert the contents of a file in the source code.
|
|
|
|
However, the standard only allows the ``++#include++`` directive to be followed by angle brackets (`<filename.h>`) or double quotes (`"filename.h"`).
|
|
|
|
If the ``++#include++`` directive contains macro names, the result of their expansion must also follow this rule:
|
|
|
|
[source,cpp]
|
|
----
|
|
#define HEADER "filename.h"
|
|
#include HEADER // Compliant
|
|
----
|
|
|
|
The behavior is undefined if neither angle brackets nor double quotes follow the ``++#include++`` directive.
|
|
|
|
== Resources
|
|
|
|
=== External coding guidelines
|
|
|
|
* MISRA C:2004, 19.3 - The #include directive shall be followed by either a <filename> or "filename" sequence.
|
|
* MISRA {cpp}:2008, 16-2-6 - The #include directive shall be followed by either a <filename> or "filename" sequence.
|
|
* MISRA C:2012, 20.3 - The #include directive shall be followed by either a <filename> or "filename" sequence
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 6 Apr 2015, 12:07:15 Evgeny Mandrikov wrote:
|
|
\[~ann.campbell.2] implementation seems more complete (SQALE, description) than this spec.
|
|
|
|
=== on 13 Apr 2015, 19:45:46 Evgeny Mandrikov wrote:
|
|
\[~ann.campbell.2] I'm wondering why blocker, but not active by default? Note that in implementation currently major and active.
|
|
|
|
endif::env-github,rspecator-view[]
|