On Sunday, 26 January 2014 at 13:48:47 UTC, Timon Gehr wrote:
On 01/26/2014 10:59 AM, Pierre Talbot wrote:
Hi,

I was wondering why CTFE is context sensitive, why don't we check
every expressions and run the CTFE if it applies?

When does it apply?

According to http://dlang.org/function.html#interpretation

* initialization of a static variable
* dimension of a static array
* argument for a template value parameter

As shown in the examples:

int square(int i) {
  return i * i;
}

void foo() {
  writeln(square(4)); // run time
}

Reply via email to