MISRA Discussion Forums
A7-1-1 and function parameters - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: AUTOSAR C++:2014 rules (https://forum.misra.org.uk/forumdisplay.php?fid=185)
+--- Thread: A7-1-1 and function parameters (/showthread.php?tid=1632)



A7-1-1 and function parameters - mstaron - 31-08-2022

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;
}



RE: A7-1-1 and function parameters - kent.dorfman766 - 05-09-2022

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"


RE: A7-1-1 and function parameters - misra cpp - 07-10-2022

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.