make a nothrow call a throwing function

Jonathan M Davis jmdavisProg at gmx.com
Fri Feb 8 01:32:09 PST 2013


On Friday, February 08, 2013 09:30:41 Artur Skawina wrote:
> On 02/08/13 01:33, Jonathan M Davis wrote:
> > Hmmm. I wouldn't have thought that you could get the function pointer at
> > compiler time. Regardless, you lose any possibility of inlining the
> > function call, which is the main problem AFAIK, though I don't know if
> > they would have been an option in the case of dup anyway.
> 
> It doesn't affect inlining. (Obviously, that's compiler dependent, but
> there's no reason why it should and indeed does not w/ gdc)

How could it not affect inlining? You're using a pointer to a function instead 
of the function itself, so it can't be inlined. Do you mean that dup in 
particular doens't get inlined even when called directly? That's quite 
possible, but in the general case, using a function pointer rather than 
calling a function directly risks taking a small efficiency hit due to the fact 
that the function can no longer be inlined.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list