Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rationale for comment rules in MISRA

Rule 2.2 in MISRA states that "source code shall only use /* ... */ style comments". Does any one know what is the rationale for this rule? what is wrong with // style comments?

like image 909
Kamyar Souri Avatar asked Mar 02 '12 18:03

Kamyar Souri


2 Answers

MISRA 1998 and 2004 only support the C90 standard ("ANSI C"). In that standard, // comments are not allowed and code containing them will not compile on C90 compilers.

MISRA 2012 supports the C99 standard and // comments.

like image 200
Lundin Avatar answered Sep 28 '22 12:09

Lundin


Further to Lundin's reply, MISRA-C:2012 (which covers C99) DOES allow // style comments

like image 27
Andrew Avatar answered Sep 28 '22 13:09

Andrew