DIP56 Provide pragma to control function inlining

Lionello Lunesu lionello at lunesu.remove.com
Sun Feb 23 18:12:56 PST 2014


On 23/02/14 20:07, Walter Bright wrote:
> http://wiki.dlang.org/DIP56
>
> Manu has needed always inlining, and I've needed never inlining. This
> DIP proposes a simple solution.

void A()
{
}

void B()
{
   pragma(inline, true) A();
}

void C()
{
   B();
}

Reading that code, I would guess that within B(), the call to A() would 
get inlined. Reading the DIP, it appears that the pragma controls 
whether B() gets inlined.

When the pragma is used outside of the scope at the function declaration 
it would work more like "inline" or "__inline" in C++, correct?

L.



More information about the Digitalmars-d mailing list