Rule 17.3 when function has 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:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.17 Functions (https://forum.misra.org.uk/forumdisplay.php?fid=172) +---- Thread: Rule 17.3 when function has definition (/showthread.php?tid=1651) |
Rule 17.3 when function has definition - dunno - 15-06-2023 I wonder if the code below violates rule 17.3: void dostuff(int x) { // do some stuff.. } void func(void) { dostuff(12); // <- is 17.3 violated here? } Please note that the functions dostuff and func violates rule 8.4 and don't have prototypes. Question: is 17.3 violated when calling a function that violates rule 8.4? The rationale for 17.3 also does not apply to my example code as far as I understand: If a function is declared implicitly, a C90 compiler will assume that the function has a return type of int. Since an implicit function declaration does not provide a prototype, a compiler will have no information about the number of function parameters and their types. |