This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]