Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule8.9 applicability to const ?
#1
Hello,

I have a question regarding rule 8.9.

We are currenly using static const instead of defines at the top of our files to manage implementation specific constants, however this is being flagged as a violation of rule8.9 if only used in one function, however as per the rationale of 8.9 this does not make all that much sense to us, is this really the intent of the rule?

Best regards

Soren
Reply
#2
Your code as described does violate rule 8.9 since a global object is only used within one function and could therefore be declared in that function.

However, the MISRA working group understands why you might want to list all your implementation specific constants in one place. In that case we suggest that you disapply this advisory rule for implementation specific constants and document the reason for doing it.
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)