Section: 23.14.7 [comparisons] Status: CD1 Submitter: Martin Sebor Opened: 2000-12-26 Last modified: 2016-02-10
Priority: Not Prioritized
View other active issues in [comparisons].
View all other issues in [comparisons].
View all issues with CD1 status.
The example in 23.14.7 [comparisons], p6 shows how to use the C library function strcmp() with the function pointer adapter ptr_fun(). But since it's unspecified whether the C library functions have extern "C" or extern "C++" linkage [18.104.22.168 [using.linkage]], and since function pointers with different the language linkage specifications (10.5 [dcl.link]) are incompatible, whether this example is well-formed is unspecified.
Change 23.14.7 [comparisons] paragraph 6 from:
[Example:replace_if(v.begin(), v.end(), not1(bind2nd(ptr_fun(strcmp), "C")), "C++");
replaces each C with C++ in sequence v.
[Example:int compare(const char*, const char*); replace_if(v.begin(), v.end(), not1(bind2nd(ptr_fun(compare), "abc")), "def");
replaces each abc with def in sequence v.
Also, remove footnote 215 in that same paragraph.
[Copenhagen: Minor change in the proposed resolution. Since this issue deals in part with C and C++ linkage, it was believed to be too confusing for the strings in the example to be "C" and "C++". ]
[Redmond: More minor changes. Got rid of the footnote (which seems to make a sweeping normative requirement, even though footnotes aren't normative), and changed the sentence after the footnote so that it corresponds to the new code fragment.]