MISRA Discussion Forums
Example for 12.06 violates 2.3 - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA-C:2004 Exemplar Suite (https://forum.misra.org.uk/forumdisplay.php?fid=116)
+--- Thread: Example for 12.06 violates 2.3 (/showthread.php?tid=768)



Example for 12.06 violates 2.3 - grafitemis - 23-08-2010

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


Re: Example for 12.06 violates 2.3 - misra-c - 02-09-2010

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.


Re: Example for 12.06 violates 2.3 - roberto - 15-10-2010

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 ) ) )


Re: Example for 12.06 violates 2.3 - misra-c - 03-11-2010

You are correct - there are 4 instances, not 5.