DIP56 Provide pragma to control function inlining

Walter Bright newshound2 at digitalmars.com
Sun Feb 23 12:40:44 PST 2014


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.

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.


More information about the Digitalmars-d mailing list