Re:C++17 constexpr everything, or as much as the compiler can
by danellis on Thursday December 28, 2017 @04:32PM
(#16025061)
What about values that aren't needed at compile time, but can be so optimized.
[ Parent
| on HN ]
Re:C++17 constexpr everything, or as much as the compiler can
by Doxin on Friday December 29, 2017 @05:17AM
(#16028709)
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();
}