Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 45 and polymorphism
#3
Both Section 6.5.2.2 of \"C89\" (Numbering as in Herbert Schildt's \"The Annotated ANSI C standard\") and ISO/IEC 9899:1999 (E), Section 6.7.2.1, Paragraph 13, make it clear that the original poster's example is perfectly legal C; no harm can come from using it with any (conforming) C compiler.

The language specifications allow this usage because of its utility---this is how to express polymorphism in C (as the original poster's title implies). Polymorphism is a central tenet of object-oriented programming.

The simplistic formulation of the MISRA rule puts it in the position of preventing object-oriented programming/polymorphism. Strict adherence to the MISRA rule as it stands now requires cumbersome, manual-intensive workarounds. These will be detrimental to MISRA's ultimate goal of preventing software errors.

Perhaps the MISRA committee can be persuaded to rethink this rule in light of its consequences.

Regards,

Konrad Schwarz
<t>Konrad Schwarz<br/>
Siemens AG<br/>
CT SE 2 (Corporate Technology, Software & Engineering - Embedded Systems)</t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)