Why is this an issue?
Line-splicing occurs when the \ character is immediately followed by a new-line character. If the source line containing a //
comment
ends with a '\', the next line becomes part of the comment. This may result in unintentional removal of code.
Noncompliant code example
void f ( void )
{
int x = 0; // comment \
if (x)
{
++x; /* This is always executed */
}
}
Resources
- MISRA C:2012, 3.2 - Line-splicing shall not be used in // comments