Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
For rule 5-2-12: replace "variable" with "value"?
#5
misra cpp Wrote:Your example is compliant f2 takes a pointer to int, &a[0] is a pointer to int - there is no decaying array
Ok, let me rephrase the question: is the code below fully compliant?

Code:
namespace nMISRA
{
  typedef unsigned char ui8;

  ui8 arr[10] = {0U};

  void f(ui8 p[])
  {
    p[10] = 1U;// in itself compliant with 5-0-15 but what about the combination of declaring arr as array and passing it as pointer to int?
  }

  void g(void)
  {
    f(&arr[0]);// in itself compliant with 5-2-12 but what about the combination of declaring arr as array and passing it as pointer to int?
  }
}
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)