Re: Funny loop with post-increment.
Brady Kelly <[email protected]> Tue, 19 Feb 2008 10:15:55 +0200
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <[email protected]> |
> i=i++ is effectively this: > > int tmp = i; > i = i + 1; > tmp = i; > > In other words, the increment happens after the evaluation of i, but > before the assignment - so the assignment just sets it back to the > original value. > > Jon Jon, I have just figured it out the same, but I think you mean your last step to be i = tmp, so i is 0 <begin i++> tmp = i i += 1 <end i++> i = tmp =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com