3 ms·
The proper annotation for a function that can run at runtime or compile time is unannotated.
by JonChesterfield 4y ago
The proper annotation for a function that can run at runtime or compile time is unannotated.
- kllrnohj 4y agoNot in C++ it isn't. If you want to change the spec to allow that go for it. But skimming eg. Zig where that's the case, it's also quite non-obvious from the docs if you can know if a function can be used in a comptime statement or not. `constexpr` makes "you can use this at compile time" an explicitly documented attribute of the function, instead of just a guess or by needing to read the implementation.