This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Why "global" variable can't be processed properly?
- From: "Robin.Horde" <robinhorde at yahoo dot com dot cn>
- To: me22 <me22 dot ca at gmail dot com>
- Cc: brian dot budge at gmail dot com, gcc-help at gcc dot gnu dot org
- Date: Wed, 29 Apr 2009 23:11:46 +0800 (CST)
- Subject: Re: Why "global" variable can't be processed properly?
- Reply-to: robinhorde at yahoo dot com dot cn
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/