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: gcc-bugs at gcc dot gnu dot org
- Subject: Re: [3.0 regression] libstdc++ and strstr
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- Date: Thu, 17 May 2001 17:42:11 -0500 (CDT)
- Organization: Networks and Infrastructure Lab (IL02/2240), Motorola Labs
- References: <200105162246.f4GMkoX33892@latour.rsch.comm.mot.com>
>| 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.
Perhaps my use of English is different than yours. But the words:
``may have'' implies ``it is possible to be this way'' not ``must be
this way''. I.e. that choice of words is not incompatible with
``unspecified''. For you C++ language lawyers out there (and Gabriel
is one of the best of them ;-), I am quite sorry I didn't quote
chapter and verse from ISO-C++-14882 section 17.4.2.2 clause 2 which I
had consulted just prior to posting my analysis of the bug reported by
Gerald:
``It is unspecified whether a name from the Standard C library
declared with external linkage has either extern "C" or extern "C++"
linkage.162) (footnote 162 reads: The only reliable way to declare
an object or function signature from the Standard C library is by
including the header that declares it, notwithstanding the latitude
granted in subclause 7.1.7 of the C Standard.)"
> I don't think it allows users to redeclare those names.
The C++ library implementor is not a normal user. To be completely
clear: I was referring to a change that we would be allowed to make as
libstdc++-v3 implementors. I am sorry if this wasn't clear from my
initial post. I assume that people discussing Gerald's bug report on
gcc-bugs will want to attempt to figure out how we (implementors not
end-users) can change libstdc++-v3 before 3.0 is released to fix this
regression from 2.95's libstdc++.
My analysis is that there is no easy quick-fix possible without
violating at least some aspect of the C++ standard. If you have some
analysis of this issue beyond what I posted or another angle to get to
a solution before finishing the shadow header work, then *please* post
it instead of nit-picking my analysis. ;-)
Regards,
Loren