Is 16.4 violated if 16.3 is?

6.16 Functions

Moderators: misra-c, david ward

Post Reply
gs
Posts: 87
Joined: Thu Nov 18, 2004 1:39 am

Is 16.4 violated if 16.3 is?

Post by gs » Thu Oct 11, 2012 9:23 pm

Given the following code:

Code: Select all

void f(int);
void f(int x){}
Does this code violate rule #16.4, identifiers used in the declaration and definition of a function shall be identical? While the lack of a parameter name in the prototype violates #16.3, I am not sure if violating #16.4 is possible in that case.

misra-c
Posts: 556
Joined: Thu Jan 05, 2006 1:11 pm

Re: Is 16.4 violated if 16.3 is?

Post by misra-c » Tue Oct 16, 2012 5:48 pm

No is doesn't really make sense to flag a violation of both rules in this case. Therefore, to violate Rule 16.4, both identifiers need to be present, but different.
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “6.16 Functions”