force inline/not-inline

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 30 11:41:51 PDT 2015


On 7/28/15 6:12 PM, David Nadlinger wrote:
> On Tuesday, 28 July 2015 at 21:29:45 UTC, Steven Schveighoffer wrote:
>> On 7/28/15 5:28 PM, Steven Schveighoffer wrote:
>>> On 7/28/15 5:24 PM, David Nadlinger wrote:
>>>> On Tuesday, 28 July 2015 at 15:56:52 UTC, Jonathan M Davis wrote:
>>>>> It[Accepting Booleans]'s far more flexible in generic code.
>>>>
>>>> It's the other way round. pragma(inline) has currently *three*
>>>> behaviors:
>>>>
>>>> pragma(inline);
>>>> pragma(inline, true);
>>>> pragma(inline, false);
>>>>
>>>> There is no way to represent those as a single boolean.
>>>
>>> Ugh. And pragma(inline) doesn't mean what you would think it means. This
>>> is not a very good API for it, it's going to confuse everyone.
>>
>> Er.. nevermind. I misread the docs. I think.
>
> I do think it is terribly confusing. pragma(inline) does not cause any
> inlining by itself at all. It just means to let the compiler do what it
> normally does (i.e. try to inline if -inline is specified).

OK, that is what I first thought. Then I thought it meant that for that 
function, it works as if -inline was passed on the command line (i.e. 
try to inline if possible, if not, don't worry about it). So you are 
saying the first interpretation is correct?

That means pragma(inline) is essentially useless.

-Steve


More information about the Digitalmars-d mailing list