25-04-2007, 09:45 AM
I would suspect that was the case, but in the example for 17.4 it is contradicted by parameter p1. The example suggests that
The problem is the inconsistency between parameter passing and assignment. Parameters are statically checked using their declaration, other variables are dynamically checked by looking at the actual address they point at!
Quote:p1[5]is not compliant due to its declaration.
Code:
void my_fn(uint8_t *p1, uint8_t p2[])
{
...
p1[5] = 0; /* not compliant - p1 was not declared as an array */
...
}
uint8_t a1[16];
uint8_t a2[16];
void test(void)
{
uint8_t *p;
my_fn(a1,a2); /*actual p1 would be pointing at an array, but the static
check in my_fn still fails it */
p = a1;
my_fn(a1,p); /* Even worse p not an array, but not detected in
my_fn as actual parameter p2 declared as an array
type. */
p[5] = 0; /* ok, dynamically check */
}
<t>Graham Andrews<br/>
Edinburgh Design Centre<br/>
Analog Devices Inc</t>
Edinburgh Design Centre<br/>
Analog Devices Inc</t>