MISRA Discussion Forums

Full Version: Example for 12.06 violates 2.3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It seems that the comments in mc2_12.06.c violate Rule 2.3:
if ( mc2_1206_boolean_a & mc2_1206_boolean_b ) /* Not Compliant -
/* bitwise operation on boolean operands */
{
;
}

Regards,

Andreas
There are 5 instances of Rule 2.3 violations in the exemplar suite file mc2_12.06.c.

This is an error. The /* sequence should not appear inside the comment.
misra-c Wrote:There are 5 instances of Rule 2.3 violations in the exemplar suite file mc2_12.06.c.

This is an error. The /* sequence should not appear inside the comment.

I count only four, i.e., these ones:

@@ -48,7 +48,7 @@ void mc2_1206 ( void )
}

if ( mc2_1206_boolean_a & mc2_1206_boolean_b ) /* Not Compliant -
- /* bitwise operation on boolean operands */
+ bitwise operation on boolean operands */
{
;
}
@@ -63,18 +63,18 @@ void mc2_1206 ( void )
}

if ( mc2_1206_x && mc2_1206_y ) /* Not compliant -
- /* logical operation on non-boolean operands */
+ logical operation on non-boolean operands */
{
;
}
if ( mc2_1206_x && ( !mc2_1206_y ) ) /* Not compliant -
- /* logical operation on non-boolean operands */
+ logical operation on non-boolean operands */
{
;
}

mc2_1206_x = ( mc2_1206_y == mc2_1206_z ); /* Not compliant -
- /* mc2_1206_x is not effectively boolean */
+ mc2_1206_x is not effectively boolean */
use_uint16 ( mc2_1206_x );

if ( mc2_1206_boolean_a && ( mc2_1206_boolean_b || ( !mc2_1206_boolean_c ) ) )
You are correct - there are 4 instances, not 5.