[3.0 regression] libstdc++ and strstr

Gabriel Dos Reis Gabriel.Dos-Reis@cmla.ens-cachan.fr
Thu May 17 05:42:00 GMT 2001


Loren James Rittle <rittle@latour.rsch.comm.mot.com> writes:

[...]

| Here is the technique: add 'extern "C"' over the definition that
| matches the standard C header version.  The C++ standard says that
| names defined by C may have extern "C" linkage even when provided by
| the new style of header names and in namespace std.

Actually it says that it is -unspecified- whether those names have C
linkage. I don't think it allows users to redeclare those names.

| #include <stdio.h>
| 
| extern "C" void foo (const char* __s);
| 
| namespace bar
| {
| extern "C" inline void foo (const char* __s) { printf ("const\n"); }
| inline void foo (char* __s) { printf ("non-const\n"); }
| }
| 
| int main ()
| {
|   char* s = "l";

This won't work.


-- Gaby



More information about the Gcc-bugs mailing list