This is the mail archive of the
mailing list for the GCC project.
Re: Builtins in `std'
- To: Mark Mitchell <mark at codesourcery dot com>, Jakub Jelinek <jakub at redhat dot com>
- Subject: Re: Builtins in `std'
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Wed, 23 May 2001 09:38:59 +0100
- CC: gcc at gcc dot gnu dot org, Jason Merrill <jason at cygnus dot com>, Benjamin Kosnik <bkoz at nabi dot net>, Gabriel Dos Reis <gdr at codesourcery dot com>
- Organization: Codesourcery LLC
- References: <20010522200302Y.email@example.com>
Mark Mitchell wrote:
> At startup, we push lots of builtins into `std'. For example, we do:
Funny you should mention this, I very nearly filed a bug report on this
With my user hat on, I got very confused when I could write something like
void foo (char const *ptr)
libfunc (ptr, libargs);
for some values of `libfunc', but not others. yeay even with -pedantic.
So as a user, I agree.
With my compiler hat on, I find it strange/ugly that we push tons of stuff
into the user/library namespace. So, again, I agree.
Sometimes I wish we could just source some special header file at startup
which declared the magic things the compiler must know about like std,
std::bad_alloc, operator new (size_t), etc. ahh, if only it were lisp,
mutter mutter ramble ...
Jakub Jelinek wrote:
> is problematic, since how would glibc find out which __builtin_* functions
> exist in a particular g++ version and which don't?
wierd idea has just occurred to me, feel free to shoot it down.
Have the compiler silently accept
and turn it into either TRT or NOP, depending on whether `whatever' is
supported. And also have it accept
(i.e. non-function call usage), and have that turn into zero or non-zero
to indicate whether `whatever' is supported.
Now glibc can code these things as
__builtin_strchr ? __builtin_strchr (str, c)
: _glibc_builtin_strchr (str, c)
maybe we could hook this into the preprocessor so
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
firstname.lastname@example.org : http://www.cs.bris.ac.uk/~nathan/ : email@example.com