Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 10.1.1
#1
Hi,

We are having a discussion with one of our tool vendors about how to interpret MISRA C++ 2023 rule 10.1.1, more concretely, the impact of the implicit 'this' parameter. I won't say which party supports which interpretation for the sake of neutrality.

Example code:
https://godbolt.org/z/hxz4bzvan


Interpretation A)
Fn() has an implicit, non-const 'this' parameter, so the rule is violated (Fn() should have been declared const).


Interpretation B)
Fn() does not have any parameters, so the rule is not violated.


We would appreciate an unbiased opinion to settle this discussion.

Best regards,
Daniel "Merge" Merget
Reply
#2
We agree with interpretation B.

The wording in the amplification ...'including use as the implicit this parameter of a non-const member function' may be misleading and we are considering changing it for the next release.
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)