I can only think that the compiler may be treating the nextState variable as constant throughout the loop. This may happen if there is no explicit change of nextState in the code inside the loop. I guess you'll have to show more code, namely the code inside the loop.
@Tolga gerekci I'm sorry but this is a bad piece of advice, so bad you made me log in to comment, I'm sorry, but the only time the while(true) loop should ever be used is for dubugging purposes - that is testing your code, it should never be used for anything else, there should allways be a way out of any loop no matter how obscure.
For the original question I would like to know why you can actually perform this action inside your code, when rogramming remember encapsulation:
but to answer your question I think we would need to see a little more code like what your doing before the loop and your definition of STATE_EXIT, thank you.