Date: Sat, 29 Mar 1997 07:44:48 -0500 Message-Id: <199703291244.HAA14737@delorie.com> From: DJ Delorie To: shearer AT pluto DOT njcc DOT com CC: djgpp AT delorie DOT com In-reply-to: <333C801C.112D@pluto.njcc.com> (shearer@pluto.njcc.com) Subject: Re: possible bug? > ++i > i++ > > when each of these is used in a loop such as below, > shouldn't the decision to pre-fix or to post-fix > affect the output of said loop? > > the following, compiled and run under djgpp(gcc272), > with the condition of the for loop being ++i or i++, > seems to result in the same for both cases. > > such shouldn't be the case, should it? That's correct for your code, because a for loop is equivalent to a while loop, like this: for (a;b;c) { code } a; while (b) { code ;c} Since the value of the "c" operation is never used and it appears after your code anyway, it doesn't matter whether you increment the value before or after you ignore it.