Why "global" variable can't be processed properly?

Robin.Horde robinhorde@yahoo.com.cn
Wed Apr 29 15:11:00 GMT 2009



Thanks for all reply

I found the problem is funny ! It look like no way can effect
GCC to change his evaluating order.
 
I meet this situation in the linux programing by accident and
intuitively I think the right hand side of assignment operator
will be first evaluation, so i write same that code. If no change
of iCurArrayIdx in the GetNewValue(), all run correctly!

I used C in multi platforms many years and never encountered this
unspecified, :-<. I also compiler the source code in Intel C++ Compiler
and Sun Studio 12 C/C++, all the run result is “1”. 

I hope GCC can be consistent with the others. Maybe that's a better way.

--horde






      ___________________________________________________________ 
  好玩贺卡等你发,邮箱贺卡全新上线! 
http://card.mail.cn.yahoo.com/



More information about the Gcc-help mailing list