inlining...

Ethan gooberman at gmail.com
Fri Mar 14 02:20:35 PDT 2014


On Friday, 14 March 2014 at 08:03:04 UTC, John Colvin wrote:
> Something always tells me this is the compilers job

If all methods are virtual by default, how can the compiler
inline the code? Properties are a great example where I'd want to
both final and inline them in quite a few cases. In those cases,
the existence of inline would negate the need for final entirely
because being a virtual method would never come in to the
equation.

This would also apply to UFCS functions, which I use to wrap D
types such as strings in to C++ interface vtables without making
the programmer jump through a bunch of hoops.

Inline in Microsoft's compiler is always considered a strong
hint. There are cases where even __forceinline won't actually
inline a function if the compiler decides you're on crack. I
assume this would be the case here, and you'd just be helping
inform the compiler what you want inlined in case it slips up and
gets it wrong.


More information about the Digitalmars-d mailing list