On 2026-03-16 12:32, Bruno Haible wrote:
But when the transformation that you are making is just reshuffling around tokens:return (TYPE1) ptr[0] | ((TYPE2) ptr[1] << 8); to ... TYPE1 v0 = ptr[0]; TYPE2 v1 = ptr[1]; return v0 | (v1 << 8); you have not eliminated any occurrence of TYPE1 or TYPE2; therefore you haven't reduced the probability of typos.
I don't see why not. Suppose the typo is that I forget the '[1]', and suppose TYPE2 is equivalent to uintptr_t. Then '((TYPE2) ptr << 8)' is valid C, whereas 'TYPE2 v1 = ptr;' is not.
I've made similar typos myself. Perhaps that's why I'm so conscious of this issue.
