2 ms·
I agree. While I didn't make an effort to actually understand the approach here, N3020 was the one that I disliked because it solves too small of an issue in pr
by jstimpfle 4y ago
I agree. While I didn't make an effort to actually understand the approach here, N3020 was the one that I disliked because it solves too small of an issue in practice and there probably can't be a simple enough solution. Any solution is probably complicated because the issue is only a symptom really.
The real issue, in my eyes is, that "const" simply doesn't transfer well across function call boundaries. "const" is always only a local judgement - data that is const for one function is not necessarily const for another function. I've even read an old conversation where Dennis Ritchie was uttering concerns about const when it was initially designed.
Typically I use the const keyword only for global static data, because there it makes a real technical difference. Sometimes I declare function pointer parameters as pointer-to-const, partly for reasons of documentation, but I'm always aware of the strstr() issue.