[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Re: sprintf
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] Re: sprintf |
Date: |
Tue, 3 Mar 2009 08:15:35 +0100 (MET) |
David Brown <address@hidden> 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. ;-)
- Re: [avr-gcc-list] Re: sprintf, David VanHorn, 2009/03/02
- Re: [avr-gcc-list] Re: sprintf, Joerg Wunsch, 2009/03/03
- Re: [avr-gcc-list] Re: sprintf,
Joerg Wunsch <=
- [avr-gcc-list] Re: sprintf, David Brown, 2009/03/03
- Re: [avr-gcc-list] Re: sprintf, Pertti Kellomäki, 2009/03/03
- Re: [avr-gcc-list] Re: sprintf, Georg-Johann Lay, 2009/03/03
- Re: [avr-gcc-list] Re: sprintf, Joerg Wunsch, 2009/03/05
- [avr-gcc-list] Re: sprintf, David Brown, 2009/03/05
- Re: [avr-gcc-list] Re: sprintf, Joerg Wunsch, 2009/03/06
- [avr-gcc-list] Re: sprintf, David Brown, 2009/03/06
- RE: [avr-gcc-list] Re: sprintf, Weddington, Eric, 2009/03/06