DIP56 - inlining

Orvid King via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 3 21:24:18 PST 2015


On Wednesday, 4 February 2015 at 05:17:11 UTC, ketmar wrote:
> On Tue, 03 Feb 2015 22:47:30 +0000, Orvid King wrote:
>
>> On Tuesday, 3 February 2015 at 22:30:22 UTC, Walter Bright 
>> wrote:
>>> http://wiki.dlang.org/DIP56
>>>
>>> There's been enough discussion, time to make a decision and 
>>> move on.
>>>
>>> I changed the description to:
>>>
>>> "If a pragma specifies always inline, and the compiler cannot 
>>> inline
>>> it, a warning will be generated. Implementations will likely 
>>> vary in
>>> their ability to inline."
>> 
>> I just created a proposal for a more general syntax to allow 
>> user's to
>> apply attributes like inlining in a way that can easily be 
>> supported
>> across compilers, and, in my eyes, is clearer about what code 
>> the
>> attribute is applied to than a pragma is.
>> 
>> http://wiki.dlang.org/DIP72
>
> gcc using `@attribute("name")` for this. it's easier and 
> requires no
> compiler hacks to ignore.

Yes, but @attribute isn't defined when compiling with DMD, 
resulting in the need for some fun with version statements. My 
proposal was to add a mechanism in the frontend to recognize it. 
@attribute also has the limitation of it being a UDA, so it can't 
be used for things like branch hinting. I meant to include it in 
DIP 72, but forgot about that aspect of it; but I'd hope with DIP 
72 to be able to allow @compiler attributes on statements, and, 
potentially, on expressions as well.


More information about the Digitalmars-d mailing list