Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A7-1-1 and function parameters
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.
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.
Posted by and on behalf of
the MISRA C++ Working Group

Forum Jump:

Users browsing this thread: 1 Guest(s)