Rule A2-7-1 (required, implementation, automated)
The character \ shall not occur as a last character of a C++ comment.
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-7-1.cpp 305382 2018-01-26 06:32:15Z 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