Rule 8.3 Function definition

6.8 Declarations and Definitions

Moderators: misra-c, david ward

Post Reply
Posts: 14
Joined: Wed Feb 14, 2018 10:02 am
Company: Inform GmbH

Rule 8.3 Function definition

Post by ankitshah413 » Wed Feb 21, 2018 10:12 am

I want to just clarify that following is a MISRA violation before using it in my code. I am calling one function from a file as under:

Code: Select all

(void)Dem_SetEventStatus((Dem_EventIdType)(dtcFlt_t.dtc[dtcIndex]), DEM_EVENT_STATUS_FAILED);
Here Dem_SetEventStatus is defined in one header as under:

Code: Select all

extern FUNC(Std_ReturnType, RTE_CODE) Dem_SetEventStatus (Dem_ASR42_EventIdType EventId, Dem_ASR42_EventStatusType EventStatus);
Here Dem_EventIdType is a typedef of unit8 and Dem_ASR42_EventIdType is unsigned short.

So , there were the violation of MISRA 8.3 right??

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

Re: Rule 8.3 Function definition

Post by misra-c » Mon Apr 16, 2018 10:16 am

Rule 8.3 concerns the types in the declaration and definition of a function.
It is not concerned with the types used in a function call.

However the example does violate rule 10.1 which does not permit the widening of types on a function call.
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “6.8 Declarations and Definitions”