From D Wiki
Revision as of 12:13, 23 February 2014 by Vladimir Panteleev (talk | contribs) (MediaWiki formatting)
Jump to: navigation, search
Title: Provide pragma to control function inlining
DIP: 56
Version: 0
Status: Draft
Created: 2014-02-23
Last Modified: 2014-02-23
Author: Walter Bright


This proposal uses pragmas to add hints to the compiler.


Sometimes generating better code requires runtime profile information. But being a static compiler, not a JIT, the compiler could use such hints from the programmer.


This adds a pragma 'inline' and two values for it: true and false, which influences the inlining of the function they appear in. 'true' means always inline, 'false' means never inline.

These are not attributes because they should not affect the semantics of the function. In particular, the function signature must not be affected.


pragma(inline, true);
pragma(inline, false);


This document has been placed in the Public Domain.