force_inline etc.

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 3 05:34:27 PST 2015


On 2/3/15 7:39 AM, Manu via Digitalmars-d wrote:
> On 3 February 2015 at 01:16, John Colvin via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>> Can we just have this:
>>
>> pragma(inline) means "inline it unless you literally can't make it work".
>>
>> pragma(force_inline) or pragma(always_inline) means "the same as
>> pragma(inline), but stop compilation if it can't be inlined".
>>
>> in the absence of either of these, "inline as you please".
>>
>>
>> A pragma is OK. It will get the job done. People need something to get the
>> job done. If Walter really doesn't like the attribute route then give his
>> taste the benefit of the doubt and let's move on.
>
> Hear hear!
> I've been in support of precisely this motion for as long as it's been
> on the table.
>
> I'd personally prefer an attribute, and I'll argue for it, but I'll
> take whatever I can get. Pragma will likely lead to text mixins, and
> difficulty discovering the state of inline attribution applied to
> functions. It may lead to meta problems of the type I'm all too
> frequently familiar with.
>

To be honest, I thought the debate was more about whether force inline 
should fail to compile if inlining cannot happen, with Walter thinking 
it should still compile. But maybe I don't remember it well enough.

-Steve


More information about the Digitalmars-d mailing list