Heroic failures (q = q++)

EvilTwin vulcan at uiuc.edu
Fri Jun 21 23:20:43 AEST 1991


In article <902 at adimail.UUCP> tel at adimail.UUCP (Terry Monks) writes:
>(Peter van der Linden (linden at adapt.Eng.sun.com)) scripsit:
>> 
>>                 q = q++;
>> 
>
>This strange statement does exactly what I expected it to do - it assigns to
>q the value of q incremented - i.e. is the same as just q++. I actually compiled
>it to make sure.
> 
>
>Terry "" Monks
>

The above has been shameless edited of all (most?) simmerage.

A co-worker and I tried the above on our respective machines.  He on an IBM
70/386 using Borland C++, I on a MicroVAX II using DEC's C version 3.1.  He
received a result of 6, I one of 5.  Why is this?  Does your chewing gum lose
it's flavor on the bedpost overnight?

Evil "Bring on the Terry's" Twin -

ps - the initial value of q was 5.



More information about the Comp.lang.c mailing list