This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: __builtin_generic
- From: "Kean Johnston" <jkj at sco dot com>
- To: "'Falk Hueffner'" <falk dot hueffner at student dot uni-tuebingen dot de>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Sat, 5 Apr 2003 01:00:35 -0800
- Subject: RE: __builtin_generic
- Organization: The SCO Group
> Thhis should be doable with __builtin_types_compatible_p, which
> already exists in recent gccs.
Sort of, in an indirect, implement-it-yourself way. The whole
idea of __builtin_generic is that it really replaces the actual
function call based on the type. So if I call cos((long double)x),
it will actually emit a call to cosld(). This handles, at the
*COMPILER* level, the equivalent of that macro the manual lists.
So yes, I agree that types_compat is at least part of the
solution, __builtin_generic is considerably cleaner (in my opinion).
The types_compatibile mechanism relies on the fact that the
optimizer will recognize a constant condition and hopefully
(I do mean hopefully, its not like the optimizer doesn't have
bugs, or like its even always active) call the desired function.
__builtin_generic is pretty much a guarantee that it will do the
right thing.
Doesn't seem like theres a lot of enthusiasm for this though,
so I guess if I want to see it implemented I'll have to do it
myself. I hope the lack of enthusiasm isnt because of my FQDN,
as has happened on other lists.
Kean