# dmd.dinterpret

The entry point for CTFE.

Specification: ($LINK2 https://dlang.org/spec/function.html#interpretation, Compile Time Function Execution (CTFE))

#### Authors

Walter Bright

#### License

Boost License 1.0

Source: dinterpret.d

Documentation: https://dlang.org/phobos/dmd_dinterpret.html

Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/dinterpret.d

- `ctfeInterpret`

  #### Declaration

  `Expression `ctfeInterpret`(Expression `e`);`

  Entry point for CTFE. A compile-time result is required. Give an error if not possible.

  #### Discussion

  ``e`` must be semantically valid expression. In other words, it should not contain any `ErrorExp`s in it. But, CTFE interpretation will cross over functions and may invoke a function that contains `ErrorStatement` in its body. If that, the "CTFE failed because of previous errors" error is raised.

- `ctfeEmplaceExp`

  #### Declaration

  `T `ctfeEmplaceExp`(T : Expression, Args...)(Args `args`);`

  Allocate an Expression in the ctfe region.

  #### Parameters

  `T` | type of Expression to allocate
  `Args `args`` | arguments to Expression's constructor

  #### Return Value

  allocated Expression

- `incArrayAllocs`

  #### Declaration

  `void `incArrayAllocs`();`

- `isRuntimeHook`

  #### Declaration

  `CallExp `isRuntimeHook`(Expression `e`, Identifier `id`);`

  Checks if the given expresion is a call to the runtime hook ``id``.

  #### Parameters

  `Expression `e`` | the expression to check
  `Identifier `id`` | the identifier of the runtime hook

  #### Return Value

  ``e`` cast to `CallExp` if it's the hook, `null` otherwise