View Single Post
  #6   (View Single Post)  
Old 20th November 2008
JMJ_coder JMJ_coder is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 464
Default

Quote:
Originally Posted by J65nko View Post
How about trying this pre-increment variation
I initially had it using pre-increment. But, it switched between 0 and 1 and I wanted it to switch between 1 and 2 -- and I have bigger fish to fry in this project (the main point is to create a game AI system). It is working the way it should with variable1 = (variable1 % 2) + 1;.

I was just wondering why one version of the compiler incremented after the rest of the statement and the other did it in the middle. And thanks to ephemera's post, I seem to have gotten my answer.

It must just be a gcc quirk to allow non-standard C. Arrgh! C'mon pcc!
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14)
Reply With Quote