Skip to main content

IAR Embedded Workbench for Arm 9.70.x

MISRAC2012-Rule-17.5

In this section:
Synopsis

(Required) The function argument corresponding to a parameter declared to have an array type shall have an appropriate number of elements.

Enabled by default

Yes

Severity/Certainty

Medium/Medium

mediummedium.png
Full description

A function call is made with the wrong array type argument.

Coding standards
MISRA C:2012 Rule-17.5

(Required) The function argument corresponding to a parameter declared to have an array type shall have an appropriate number of elements

Code examples

The following code example fails the check and will give a warning:

void callee(int array[10]);

void caller(void) {
	int arr4[4];
	callee(arr4);
}

The following code example passes the check and will not give a warning about this issue:

void callee(int array[10]);

void caller(void) {
	int arr4[10];
	callee(arr4);
}