This is the mail archive of the
mailing list for the GCC project.
Re: Builtins in `std'
On 23-May-2001, Jakub Jelinek <firstname.lastname@example.org> wrote:
> On Wed, May 23, 2001 at 09:55:31AM -0700, Mark Mitchell wrote:
> > In C++, there is no such standard function as `::strchr', and it would
> > be wrong to optimize it specially. A user program like:
> But the C++ standard includes implicitely ISO C standard which defines what
> strchr does.
The C++ standard explicitly includes (by reference) parts of the ISO C
standard. However, in C++ the C standard library functions are not
defined in global scope, they are instead defined in namespace std.
See the quote below.
It is true that the C++ standard allows the implementation to optimize
`::strchr' specially, but this is because C standard library function
names are reserved for the implementation by the relevant part of the
C++ standard (see my earlier post), not directly because the C standard
| 184.108.40.206 - Library contents [lib.contents]
| -4- Except as noted in [...]
| the contents of each header cname shall be the same
| as that of the corresponding header name.h, as specified in ISO/IEC
| 9899:1990 Programming Languages C (Clause 7), or ISO/IEC:1990
| Programming Languages --- C AMENDMENT 1: C Integrity, (Clause 7), as
| appropriate, as if by inclusion. In the C++ Standard Library, however,
| the declarations and definitions (except for names which are defined
| as macros in C) are within namespace scope (basic.scope.namespace) of
| the namespace std.
Fergus Henderson <email@example.com> | "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.