On the richness of C++

Tomas Lindquist Olsen tomas at famolsen.dk
Fri Apr 18 05:52:21 PDT 2008


Walter Bright wrote:
> Sean Kelly wrote:
>> Sure, but templates don't suit every situation.  It's not uncommon for
>> APIs to have to overload on accepting a function and a delegate for
>> flexibility.
> 
> The only way to merge function pointers with delegates is to have the 
> compiler generate trampolines. This isn't very runtime efficient - the 
> template approach will be faster.

I was reading about these a few days ago, as LLVM has support for these. Basically it's also 
how GCC implements its nested function extension. I figured someone else might find this link 
interesting!

There's a link to a paper on trampolines in the article linked as well:
http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html



More information about the Digitalmars-d mailing list