Confusion over rule 17-0-3

Moderators: david ward, misra cpp

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

Confusion over rule 17-0-3

Postby gs » Mon Aug 25, 2008 8:43 pm

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

Re: Confusion over rule 17-0-3

Postby pkruk » Mon Feb 01, 2010 11:54 am

Posts: 20
Joined: Mon Aug 01, 2005 8:24 pm
Company: JB Enterprises
Location: Germany

Re: Confusion over rule 17-0-3

Postby jbezem » Mon Feb 01, 2010 1:51 pm

Reused: used again, so the name is used first, and later in a compilation unit or between compilation units it is used again, possibly with a different definition. This is only possible with certain kinds of objects, like macros or global/local/static variables, especially _not_ for functions.
Overridden: The new definition completely replaces the old one, ven in those places (e.g. in the library) where the previous version is supposed to be used.
Because of the modus operandi of the linker it might be possible to create a function 'printf' having an signature identical to the standard library function. The library will take your definition, and ignore the definition in the library (as a rule, possibly generating a warning).
Overloaded: In OO programming, if you create a function of the same name but with different parameter(-types), both the standard library function definition and your new one can be in scope at the same time, and the variant chosen is determined by the linker.

The wording in 17-0-* is consistent with my descriptions AFAICT.


Johan Bezem
Tel: +49 172 5463210

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

Re: Confusion over rule 17-0-3

Postby misra cpp » Tue Oct 11, 2016 11:15 am

The original intention of the rule was to cover the “replacing” of standard library functions.

A future edition will remove the use of 'override' and clarify the actual intent
Posted by and on behalf of
the MISRA C++ Working Group

Return to “6.17 Library introduction (C++)”

Who is online

Users browsing this forum: No registered users and 0 guests