3 ms·
I feel like this is analogous to throwing the baby out with the bath water. I think writing const-correct code where you can is useful. It helps document your
by jjnoakes 10y ago
I feel like this is analogous to throwing the baby out with the bath water.
I think writing const-correct code where you can is useful. It helps document your code (for yourself and for others), it CAN catch issues (even if Casey Muratori claims it never helped), and it really isn't that hard to do (C routines don't need to be duplicated if you want to return non-const, like strstr, for example).
So what if you have to cast-away-const for interfacing to libraries which aren't const-correct? It still has benefits for your own code.