DIP56 Provide pragma to control function inlining

Dmitry Olshansky dmitry.olsh at gmail.com
Sun Feb 23 13:09:26 PST 2014


24-Feb-2014 00:40, Walter Bright пишет:
> On 2/23/2014 5:01 AM, Vladimir Panteleev wrote:
>> I think there should be some way to force the compiler to inline a
>> function. As
>> a bonus, the error message can tell the programmer why the function
>> could not be
>> inlined, allowing them to make the necessary adjustments.
>>
>> Different compilers will have different inlining capabilities, however
>> at the
>> point where programmers are forcing inlining on or off, they are already
>> micro-optimizing at a level which implies dependency on particular
>> compiler
>> implementations.
>
> I think it would be a porting nuisance to error out when the compiler
> can't inline. The user would then fix it by versioning out for that
> compiler, and then the user is back to the same state as it being a
> recommendation.

Porting across compilers you mean?
While porting making temporary changes is fine, like turning off 
force_inline where it doesn't work. Without this error you are facing a 
silent performance disaster you still need to figure out.

Fail fast for the win.

> Generally, when I optimize at that level, I have a window open on the
> assembler output of the compiler and I go back and forth on the source
> code until I get the shape of the assembler I need. Having compiler
> messages wouldn't be very helpful.

Will save you the trouble of looking at the assembly window to begin 
with. Because you known ahead of time you wouldn't see what you like.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list