Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making constants in MISRA compliant C++
#5
The preferred method of declaring constants in C++ is 2, though 3 is acceptable in the specific case of declaring or accessing an array.

Your checker shouldn't report 2 as a violation of the ODR (3-1-1)

In a future version or Technical Corrigendum we ought to consider clarifying that 3-1-1 does not apply to const declarations.

If the const were made static, 2-10-5 may also need modification to allow it as an exception
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)