Content deleted Content added
m →Example |
Moved C++ description to one section. Removed unrefernced comment on "less power" in generalised constant expressions. |
||
Line 26:
Using compile-time function evaluation, code used to compute the factorial would be exactly the same as what one would write for run-time evaluation.
In [[C++11]],
Here's an example of CTFE in the [[D programming language]]:<ref>[http://d-programming-language.org/function.html#interpretation D 2.0 language specification: Functions]</ref>
Line 61 ⟶ 63:
// 39_916_800, 479_001_600]
</source>
▲In [[C++11]], a similar (less powerful) technique is known as [[C++11#constexpr – Generalized constant expressions|generalized constant expressions]](<code>constexpr</code>). [[C++14]] [[C++14#Relaxed_constexpr_restrictions|relaxes the constraints]] on constexpr – allowing local declarations and use of conditionals and loops (the general restriction that all data required for the execution be available at compile-time remains).
==References==
|