Difference between revisions of "DIP56"

From D Wiki
Jump to: navigation, search
(MediaWiki formatting)
Line 32: Line 32:
  
 
== Description ==
 
== Description ==
<div style="padding: 1ex 1ex; background: #ffd;">This section has been adapted for MediaWiki.</div>
 
 
 
This adds a pragma 'inline' and two values for it: true and false, which influences the inlining of the
 
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.
 
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
+
These are not attributes because they should not affect the semantics of the function.
must not be affected.
+
In particular, the function signature must not be affected.
  
 
== Usage ==
 
== Usage ==
<div style="padding: 1ex 1ex; background: #ffd;">This section has been adapted for MediaWiki.</div>
 
 
pragma(inline, true);
 
pragma(inline, false);
 
  
 +
pragma(inline, true);
 +
pragma(inline, false);
  
 
== Copyright ==
 
== Copyright ==

Revision as of 12:13, 23 February 2014

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
Links:

Abstract

This proposal uses pragmas to add hints to the compiler.

Rationale

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.

Description

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.

Usage

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

Copyright

This document has been placed in the Public Domain.