MISRA C:2012 Rule 3.1
The character sequences /*
and //
shall
not be used within a comment
Description
Rule Definition
The character sequences /*
and //
shall
not be used within a comment1
.
Rationale
These character sequences are not allowed in code comments because:
If your code contains a
/*
or a//
in a/* */
comment, it typically means that you have inadvertently commented out code.If your code contains a
/*
in a//
comment, it typically means that you have inadvertently uncommented a/* */
comment.
Polyspace Implementation
You cannot annotate this rule in the source code.
For information on annotations, see Annotate Code and Hide Known or Acceptable Results.
Additional Message in Report
The character sequence /*
shall not appear
within a comment.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Comments |
Category: Required |
AGC Category: Required |
Version History
Introduced in R2014b
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace® Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.