Rule 11.1 Interpretation

6.11 Pointer Type Conversions

Moderators: misra-c, david ward

Posts: 4
Joined: Wed Feb 01, 2006 11:08 am
Location: Bangalore, INDIA

Rule 11.1 Interpretation

Post by nikunj » Thu Feb 02, 2006 8:59 am

Rule 11.1 says that, 'coversions shall not be performed between a pointer to a function and any other type other than an integral type'

what do the 'integral type' refer to?

Is there a violation in the following code:

int (*p)();
int *a;
p = a; /* is this a violation of Misra rule 11.1 ? */

Posts: 566
Joined: Thu Jan 05, 2006 1:11 pm

Post by misra-c » Tue Jun 20, 2006 3:12 pm

integral type is defined char, short, int, long, ( signed and unsigned).

Your code example is a constraint error, which breaks rule 1.1.

Most pointer conversions require an explicit cast.
Posted by and on behalf of
the MISRA C Working Group


Return to “6.11 Pointer Type Conversions”