Is the specification of `bsearch` in C++11 & C++14 defective?

But the parameter types list are not the same. In one, compar is a pointer to a function with “C” language linkage, in the other one, it’s a pointer to a function with “C++” language linkage.

C++11, 7.5 specifies:

1 … Two function types with different language
linkages are distinct types even if they are otherwise identical.

4 In a linkage-specification, the specified language linkage applies to the function
types of all function declarators, function names with external linkage, and variable names with external
linkage declared within the linkage-specification. [ Example:

extern "C" void f1(void(*pf)(int));
// the name f1 and its function type have C language
// linkage; pf is a pointer to a C function

The seeming inconsistency between 7.5/1 and 7.5/5 is solved when realising that 1 talks about function types, while 5 addresses function names.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)