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]
Other format: [Raw text]

RE: __builtin_generic

> 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.


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