MISRA Discussion Forums

Full Version: A7-1-1 and function parameters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The 'A7-1-1' uses the term: 'immutable data declaration'. This is not defined in the C ++ standard, so it is unclear if this rule applies to function parameters.
Code:
int f(int x)  // Is it Non-compliant?
{
  return x;
}
As written above, I'd expect it to be flagged as non-compliant since you don't modify (x) within the function, thus making it a candidate to be "const int x"
Autosar inherited this rule from MISRA C++:2008  7-1-1, in the MISRA rule its is clear that parameters are included, so your example is non-compliant.

This is being reviewed for the next version.