Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A7-1-1 and function parameters
#1
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;
}
Reply
#2
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"
Reply
#3
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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)