This is the mail archive of the 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'

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

--begin foo.c
void foo (char const *ptr)
	libfunc (ptr, libargs);
--end foo.c
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
	__builtin_whatever (...)
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
	#if __builtin_whatever


Dr Nathan Sidwell   ::   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?' : :

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