lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #18924] index in etharp.c ( function etharp_arp_input


From: David Empson
Subject: [lwip-devel] [bug #18924] index in etharp.c ( function etharp_arp_input )
Date: Thu, 01 Feb 2007 05:10:28 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

Follow-up Comment #2, bug #18924 (project lwip):

There is nothing wrong with the original code. i-- as a separate statement
will result in i being decremented before it is first used as an array index.
It is identical to --i in this context. The first iteration of the loop will
therefore access array element 5, and the last iteration will access array
element 0.

i-- only differs from --i if it is used in a more complex expression where
the value of i is used immediately.

e.g. if i is currently 5 then addr[i--] would access addr[5] and decrement i
to 4, but addr[--i] would decrement i to 4 and access addr[4].

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?18924>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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