MISRA Discussion Forums
Rule 8.3 Function definition - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA-C: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17)
+---- Forum: 6.8 Declarations and Definitions (https://forum.misra.org.uk/forumdisplay.php?fid=35)
+---- Thread: Rule 8.3 Function definition (/showthread.php?tid=1401)



Rule 8.3 Function definition - ankitshah413 - 21-02-2018

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:
(void)Dem_SetEventStatus((Dem_EventIdType)(dtcFlt_t.dtc[dtcIndex]), DEM_EVENT_STATUS_FAILED);

Here Dem_SetEventStatus is defined in one header as under:

Code:
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??


Re: Rule 8.3 Function definition - misra-c - 16-04-2018

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.