Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
M9-3-3 and observable state
#3
@cgpzs The answer provided with https://forum.misra.org.uk/thread-1594-p...ml#pid3496 was:


Quote:The rule as drafted was intended to just cover 'syntactic const', but we recognise that this has limitations.

In this case, you'll need to deviate, or artificially modify the function so that it cannot be made const. 

That answers the "what is the correct interpretation of MISRA C++ 9-3-3" part of my question - thank you.


However, the AUTOSAR GuidelineM9-3-3 explicitly references Con.2, which is about observable state. Therefore, I think it is a legitime question to ask what is(/was) intended with M9-3-3 and in the future (MISRA C++ 202x).

I also think that the majority of developers that consult the C++ Core Guidelines will ask the question again when a static analysis tool reports a finding for code that changes the observable state (see my examples). 

Frankly, I would welcome, if the next version of the MISRA C++ rules would contain an exception for code that violates the observable state - or at least a clarification concerning the differences to Con.2.
Reply


Messages In This Thread
M9-3-3 and observable state - by kth - 14-04-2022, 01:32 PM
RE: M9-3-3 and observable state - by cgpzs - 20-04-2022, 07:50 AM
RE: M9-3-3 and observable state - by kth - 20-04-2022, 08:22 AM
RE: M9-3-3 and observable state - by misra cpp - 29-04-2022, 12:20 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)