DIP56 Provide pragma to control function inlining

Iain Buclaw ibuclaw at gdcproject.org
Sun Feb 23 22:58:50 PST 2014


On Feb 24, 2014 1:15 AM, "Andrei Alexandrescu" <
SeeWebsiteForEmail at erdani.org> wrote:
>
> On 2/23/14, 4:07 AM, 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.
>
>
> This makes inlining dependent on previously-seen code. Would that make
parallel compilation more difficult?
>
> I've always thought the obvious/simple way would be an attribute such as
@forceinline and @noinline that applies to individual functions.
>
>
> Andrei
>

GDC already has both of these as a compiler extended attribute (need to
document these!!!)

import gcc.attribute;

@attribute("forceinline") ...

Being backend attributes, you can't enforce that these attributes actually
take effect in user code (no static asserts!) - but you have some guarantee
in that the backend will complain if it can't apply the attribute - this is
good because the compiler will always produce a better diagnostic than some
user static assert, always.

Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140224/cc1a17b3/attachment-0001.html>


More information about the Digitalmars-d mailing list