4 ms·
To elaborate, the rule is roughly that if a and b are different arrays, a[i] and b[j] do not alias. If pointers-are-integers, a[b-a] and b[0] alias. In C stan
by sanxiyn 6y ago
To elaborate, the rule is roughly that if a and b are different arrays, a[i] and b[j] do not alias.
If pointers-are-integers, a[b-a] and b[0] alias.
In C standard, while a[b-a] and b[0] are same integers, they are not same pointers, because "a and b are different arrays" imply a[b-a] is out-of-bound access hence invalid. This is actually very reasonable. Pointers are not integers.
- aw1621107 6y ago> the rule is roughly that if a and b are different arrays, a[i] and b[j] do not alias. This is technically stricter than the strict aliasing rule, isn't it? Since it also disallows aliasing through pointers of the same type? Or am I getting concepts mixed up here, since strict aliasing is for pointers and you're talking about arrays?