Rule 2-10-5 and function overloading

Moderators: david ward, misra cpp

Post Reply
pkruk
Posts: 20
Joined: Fri Jul 27, 2007 3:25 pm

Rule 2-10-5 and function overloading

Post by pkruk » Wed Jul 23, 2008 5:26 pm

Hello,

does rule 2-10-5 disallows function overloading? What is the definition of "identifier reuse"?
For example:

Code: Select all

class C{}; 
void foo(int);
void foo(C);      // Not compliant?
void foo(int, C); // Not compliant?

ggoulas
Posts: 5
Joined: Tue Jun 09, 2009 1:43 pm
Company: The MathWorks

Re: Rule 2-10-5 and function overloading

Post by ggoulas » Fri Feb 25, 2011 3:36 pm

Hello,

Did you get any answer to this?
Does anybody have an opinion on 2-10-5 and function overloading?

thank you.

misra cpp
Posts: 150
Joined: Mon Jun 02, 2008 1:55 pm
Company: MISRA

Re: Rule 2-10-5 and function overloading

Post by misra cpp » Tue Oct 11, 2016 10:11 am

The short answer is No, this rule does not prohibit function overloading. The intent was to prohibit the reuse of identifiers for unrelated objects.

This will be clarified in a Technical Corrigendum
Posted by and on behalf of
the MISRA C++ Working Group

Post Reply

Return to “6.2 Lexical conventions (C++)”