3 ms·
Testing. If you wanted to test that your compile-time code is correct, I'd imagine the typical--if not only--way to do that would be to compile it. Certainly th
by usefulcat 5y ago
Testing. If you wanted to test that your compile-time code is correct, I'd imagine the typical--if not only--way to do that would be to compile it. Certainly that's true for constexpr in c++.
- johannes1234321 5y agoyou could compile it to verify, but you usally compile it using a build system to set include paths right etc. that build system could include a `rm -rf $HOME 2>/dev/null` or similar already.
- SubjectToChange 5y agoTesting code requires executing it. This is true for compile-time code or run-time code.
- WalterBright 5y agoQuite a lot of the tests in the D compiler suite are compile time only. It makes for running the test suite much faster. To test ImportC, which inherits D's ability to execute functions at compile time, I've been using a lot of _Static_assert() constructs. https://github.com/dlang/dmd/blob/a5b16bd8e72a447d509cca862e2ac8ad3353ee43/test/compilable/testcstuff1.c#L131 https://github.com/dlang/dmd/blob/a5b16bd8e72a447d509cca862e...