David Brown <[email protected]> wrote:
> Secondly, using pointer arithmetic when array access is the
> logically correct method is very bad practice.
That's often a matter of taste. Once you grasped the C pointer
semantics, I usually find
foo + i
much easier to parse than
&foo[i].
Both expressions are always equivalent.
Of course,
*(foo + i)
is terrible, because
foo[i]
is much clearer then.
Anyway, for the compiler, it should never make any difference, because
these expressions are identical in their effect. If the compiler can
(statically) bounds-check &foo[i], I don't see why it would not be
able doing so for foo + i. (Most of the time, it cannot check it
though.)
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list