4 ms·
Yes, there are many cases where the caller can optimize the dependency chain / order of constFoo(x); constBar(x); where it couldn't make that assumpti
by vortico 7y ago
Yes, there are many cases where the caller can optimize the dependency chain / order of
constFoo(x);
constBar(x);
where it couldn't make that assumption if one function wasn't const.
- mlyle 7y agoUnfortunately, C++ const functions are not necessarily pure functions and cannot be freely reordered.
- vortico 7y agoYou're right, I was mistaken. And if the function is in the same compilation unit so the compiler is able to prove that it's pure, it would also be able to prove that a non-const pointer is actually const.