| ||||||
| 5/17 |
| 2004/9/28-29 [Computer/SW/Languages/C_Cplusplus] UID:33807 Activity:nil |
9/28 Does anybody use this sort of style for for loops in C:
Foo *ptr;
int i;
for (i=0; i < arraySize; ptr = &array[i++])
? Does it work well?
\_ Uh, what's the point? If you're going to go through the trouble
of having an explicit index and doing the add-and-dereference
thing (which a compiler should optimize away anyway), why not use
array[i] instead of ptr?
\_ Aside from the point above, looks like you're not initializing ptr
on the first iteration. |