This is the mail archive of the gcc@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: Builtins in `std'


On 23-May-2001, Mark Mitchell <mark@codesourcery.com> wrote:
> In C++, there is no such standard function as `::strchr', and it would
> be wrong to optimize it specially.  A user program like:
> 
>   char *strchr(const char *, int) { return 0; }
> 
> must be accepted, must not count as a redefinition of the `strchr' in
> the standard library, must not result in errors about defining two
> functions with the same type, etc.

I'm pretty sure that's not correct.
It doesn't match my understanding of what the C++ committee intended,
and this program also seems to violate 17.4.3.1.3/5.

 |    17.4.3.1.3 - External linkage [lib.extern.names]
 ...
 |    -5- Each function signature from the Standard C library declared with
 |    external linkage is reserved to the implementation for use as a
 |    function signature with both extern "C" and extern "C++" linkage,
 |    or as a name of namespace scope in the global namespace.

There is no standard function named `::strchr', but nevertheless
`::strchr' is reserved.  This means that implementations are free to
allow user programs like that, but are not required to do so.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


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