19-01-2018, 08:45 AM
misra cpp Wrote:Your example is compliant f2 takes a pointer to int, &a[0] is a pointer to int - there is no decaying arrayOk, 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>