This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [3.0 regression] libstdc++ and strstr


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]