avr-gcc-list
[Top][All Lists]
Advanced

[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. ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]