DIP56 Provide pragma to control function inlining
Walter Bright
newshound2 at digitalmars.com
Mon Feb 24 00:57:16 PST 2014
On 2/23/2014 6:12 PM, Lionello Lunesu wrote:
> 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();
No. This would be:
pragma(inline, true);
A();
and then B() will be inlined when it is encountered.
> }
>
> 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?
Yes.
More information about the Digitalmars-d
mailing list