4 ms·
I don't think that's necessarily true, using constexpr facilities you could make a function do nothing according to a compile-time variable value
by frabert 8y ago
I don't think that's necessarily true, using constexpr facilities you could make a function do nothing according to a compile-time variable value
- Ace17 8y agoI agree ; however, the tricky part - I believe - is not computing the message string in case you're not going to print/record it.
- xamolxix 8y agoIs IO allowed in constexpr functions?
- justbuchanan 8y agoI don't think so, but for zero-cost logging you just need the conditional for your branch to be constexpr. If the branch is known not to be taken at compile time, the compiler can just throw it away. Something like: void MyDebugLog(text) { if (<constepxr check if logging enabled>) { // actually log... } }