AutosarC++17_10-A2.8.1ΒΆ
The character shall not occur as a last character of a C++ comment
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
If the last character in a single-line C++ comment is \, then the comment will continue in the next line. This may lead to sections of code that are unexpectedly commented out.
Example
// $Id: A2-8-1.cpp 289436 2017-10-04 10:45:23Z michal.szczepankiewicz $
#include <cstdint>
void Fn() noexcept {
std::int8_t idx = 0;
// Incrementing idx before the loop starts // Requirement X.X.X \\
++idx; // Non-compliant - ++idx was unexpectedly commented-out because of character occurrence in the end of C++ comment
constexpr std::int8_t limit = 10;
for (; idx <= limit; ++idx) {
// ...
}
}
See Also
- none
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
line_splicing_in_cpp_comment |
Line-splicing shall not be used in // comments. |
None |
False |
Options
This rule shares the following common options: confidence, exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.