Re: Funny loop with post-increment.

silky <[email protected]> Tue, 19 Feb 2008 20:08:21 +1100
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
On Feb 19, 2008 8:01 PM, Brady Kelly <[email protected]> wrote:
> Ryan:
>
> > The feature that the returned value of i++ is i and not i+1.
>
> I've always accepted that as a given, it's just in this situation I thought
> i would be assigned i, not i+1, then i would be incremented, not i
> incremented and pre-i++ assigned back to i.

it's not "pre" i++. it happens after that. i is equal to the result of
the expression "i++". what you are missing is that i++ in that
expression doesn't actually affect the end result of "i" (even though
it is calculated) because it's overwritten.

--
http://lets.coozi.com.au/

A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com