Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can anyone explain this paragraph of the current C++0x standard draft?

Can anyone explain this statement from ISO N3242 §3.2, 2nd point

A member of a set of candidate functions is odr-used if it is selected by overload resolution when referred to from a potentiallyevaluated expression. [ Note: This covers calls to named functions (5.2.2), operator overloading (Clause 13),user-defined conversions (12.3.2), allocation function for placement new (5.3.4), as well as non-default initialization(8.5).

ISO Standard 2003 : says

An overloaded function is used if it is selected by overload resolution when referred to from a potentially-evaluated expression. [Note: this covers calls to named functions (5.2.2), operator overloading (clause 13), user-defined conversions (12.3.2), allocation function for placement new (5.3.4), as well as non-default initialization (8.5).

What is the actual difference in these statements?

Can any one explain this with the help of an example/program?

like image 490
1User Avatar asked Dec 28 '22 22:12

1User


2 Answers

The terminology "overloaded function" is (slightly) ambiguous between referring to the member or to the set. C++11 clarifies that functions that are never selected from a potentially-evaluated expression are not odr-used.

The term "odr-used" is new with C++11. It essentially means that the given object might be represented in the final, compiled binary file, and that the one-definition rule applies.

like image 103
Potatoswatter Avatar answered Jan 17 '23 17:01

Potatoswatter


The paragraph was changed to fix the Core Issue #1174. There you can find the example which shows the difference.

like image 35
Kirill V. Lyadvinsky Avatar answered Jan 17 '23 17:01

Kirill V. Lyadvinsky