digitalmars.D.learn - Why can't compile time expressions do ___?
- cy (3/3) Feb 06 2016 I'm not clear on why you aren't allowed to allocate memory with
- Adam D. Ruppe (10/14) Feb 06 2016 CTFE is a "pure" environment, it is supposed to only depend on
I'm not clear on why you aren't allowed to allocate memory with compile time execution, or why access to the filesystem is restricted. (Unless you pass -J/ I think?)
Feb 06 2016
On Saturday, 6 February 2016 at 22:13:55 UTC, cy wrote:I'm not clear on why you aren't allowed to allocate memory with compile time executionYou can... use the built-in new operator or arrays, etc.or why access to the filesystem is restricted. (Unless you pass -J/ I think?)CTFE is a "pure" environment, it is supposed to only depend on the code and passed compile options (which may indeed include a path with -J that you are allowed to read files from). It doesn't actually run a complete program on the installed computer / OS, it just does some computations. This is meant to be a security thing (which IMO is dubious) and a platform issue: D code can be compiled independently of an operating system.
Feb 06 2016