3 ms·
What if it was always allowed to do compile time, but you could add a keyword to assert it did (like force-inline). That way you get benefits by default. Where
by thebigwinning 3y ago
What if it was always allowed to do compile time, but you could add a keyword to assert it did (like force-inline).
That way you get benefits by default. Whereas right now it's not allowed to.
- masklinn 3y agoThese are two completely different things. One is the provider of the API promising that the function supports compile-time evaluation. The second is the consumer of the API ensuring that an expression has been compile-time evaluated. It's nice that the consumer can make sure, but that's not helpful if the provider of the API never specifically intended for a function to be evaluatable at compile-time. > Whereas right now it's not allowed to. Of course it's allowed, but you're at the mercy of the compiler's decisions.
- thebigwinning 3y ago> Of course it's allowed, It's not. If you to use a function in a constexpr context then it will complain it needs to be marked as such. So the API creator needs to label every function in case a client wants to use it.