2 ms·
Running code at compile time in D is not an automatic optimization. Only code in certain constructs are ran at compile time, for example function calls in varia
by Doxin 9y ago
Running code at compile time in D is not an automatic optimization. Only code in certain constructs are ran at compile time, for example function calls in variable declarations or static if statements. Generally it's not something you even need to think about. This runs foo() at compile time:
int bar=foo();
This runs foo() at runtime:
int bar;
void main(){
bar=foo();
}