Compile-time function execution: Difference between revisions

Content deleted Content added
How is this original research? What are we supposed to cite, language specifications?
PigFlu Oink (talk | contribs)
fmt headline levels (to start with "==", WikiCheck check #7
Line 1:
'''Compile time function execution''' is the ability of a [[compiler]], that would normally compile a function to machine code and execute it at run time, to execute the function at compile time. This is possible if the arguments to the function are known at compile time, and the function does not make any reference to or attempt to modify any global state (is a [[pure function]]). Even if the value of only some of the arguments are known, the compiler may still be able to perform some level of compile time function execution ([[partial evaluation]]), possibly producing more optimized code than if no arguments were known.
 
===Example 1===
 
This example code is in the [[D programming language]]<ref>[http://www.digitalmars.com/d/1.0/function.html#interpretation D 1.0 language specification: Functions]</ref>:
Line 14:
</source>
 
===Example 2===
 
In [[C++]], [[template metaprogramming]] is often used to compute values at compile time, such as: