2 ms·
It takes a lot more than that to get const correctness right. Consider the strstr function. The constness of the result really ought to match the constness of t
by burfog 11y ago
It takes a lot more than that to get const correctness right. Consider the strstr function. The constness of the result really ought to match the constness of the first argument.
It can get much worse. Consider a function that takes two strings as arguments, then returns the longer one. Constness of the result ideally depends on the input. At the very least, when both inputs have the same constness you'd expect the result to also have that constness.