[Top][All Lists]

[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: Gecko/20061204 Firefox/

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:


  Message sent via/by Savannah

reply via email to

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