DIP56

From D Wiki
Revision as of 12:03, 23 February 2014 by WalterBright (talk | contribs) (Add pragma to control function inlining)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Title: Add pragmas to influence 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 section has been adapted for MediaWiki.

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

This section has been adapted for MediaWiki.

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


Copyright

This document has been placed in the Public Domain.