04-08-2025, 07:59 AM
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
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