Hello,
I noticed that if I give g++ the prototypes for bsearch as listed in the 2003
standard, it errors out saying that the 2 declarations conflict:
extern "C" void *bsearch(const void *key, const void *base, size_t nmemb,
size_t size, int (*compar)(const void *, const void *));
extern "C++" void *bsearch(const void *key, const void *base, size_t nmemb,
size_t size, int (*compar)(const void *, const void *));
The same is true for qsort. I believe the compiler is supposed to distinguish
between the 2 versions according to the linkage of compar.
Even if you don't want to distinguish functions according to linkage, g++
should be able to accept a declaration that is written in the standard.
--
Summary: g++ does not distinguish functions with C and C++
linkage
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: marc dot glisse at normalesup dot org
GCC host triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30062