DIP56 - inlining

Zach the Mystic via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 4 13:22:53 PST 2015


On Wednesday, 4 February 2015 at 20:09:04 UTC, Walter Bright 
wrote:
> On 2/4/2015 8:29 AM, Andrei Alexandrescu wrote:
>> On 2/4/15 4:02 AM, Walter Bright wrote:
>>> On 2/4/2015 1:39 AM, ponce wrote:
>>>> Would pragma(inline, <bool-expr>) be supported though?
>>> Yes. That's what I intended, sorry the wording wasn't clear.
>> Please nail it down in the doc so it doesn't get neglected. -- 
>> Andrei
>
> Reading the DIP again,
>
> "This adds a pragma 'inline', which is followed by an optional 
> boolean expression, which influences the inlining of the 
> function it appears in. An evaluation of 'true' means always 
> inline, 'false' means never inline, and no argument means the 
> default behavior."
>
> Seems clear enough.

It just occurred to me, you might to take an small integer as the 
second parameter, so people can customize their whole builds:

enum useDefaultInline = 0;
enum useProfilingInline = 1;
enum forceInlines = 2;

enum inlineStrategy = forceInlines; // change this at will

pragma(inline, inlineStrategy); // now you can get always, never, 
or default as you choose

With only a bool as the second parameter, you couldn't do this.


More information about the Digitalmars-d mailing list