Summary: index in etharp.c ( function etharp_arp_input )
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: None
Submitted on: Thursday 02/01/2007 at 04:37 UTC
Severity: 3 - Normal
Item Group: None
Assigned to: None
Discussion Lock: Any
[bug #18924] index in etharp.c ( function etharp_arp_input )
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
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 and decrement i
to 4, but addr[--i] would decrement i to 4 and access addr.