This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [3.0 regression] libstdc++ and strstr
- To: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- Subject: Re: [3.0 regression] libstdc++ and strstr
- From: Gabriel Dos Reis <Gabriel dot Dos-Reis at cmla dot ens-cachan dot fr>
- Date: 17 May 2001 14:42:18 +0200
- Cc: gcc-bugs at gcc dot gnu dot org, pfeifer at dbai dot tuwien dot ac dot at
- Organization: CMLA, ENS Cachan -- CNRS UMR 8536 (France)
- References: <200105162246.f4GMkoX33892@latour.rsch.comm.mot.com>
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