This is the mail archive of the gcc@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: Increment Operator


On Thu, Aug 10, 2006 at 05:34:16AM +0000, Kapil Dhawan wrote:
> >From: Mike Stump <mrs@apple.com>
> >To: Kapil Dhawan <carchitect@hotmail.com>
> >CC: gcc@gcc.gnu.org
> >Subject: Re: Increment Operator
> >Date: Wed, 9 Aug 2006 10:00:34 -0700
> >
> >On Aug 7, 2006, at 2:31 AM, Kapil Dhawan wrote:
> >>I am very much confused about Increment Operator implementation.  Can 
> >>somebody send me a link about the gcc implementation.
> >
> >If you don't get any response, please see the source code and the svn  
> >history and the mailing list archievs for additional information.
> 
> I tried searching through and got the info like...Expression evaluation 
> depends upon sequence point as well. So if a varibale is getting changed 
> more than once between two adjacent sequence points then it is undefined 
> behaviour and becomes compiler dependent.
> 
> I tried to convert source code into assembly also to try n deduce some 
> logic but unable to do so.

You're apparently interested in how GCC handles increment operators
within expressions that have other uses of the lvalue being incremented.
Undefined behavior is not compiler-dependent, and GCC has no rules,
documented or otherwise, about what happens in this case.  The behavior
of the program can differ depending on optimizations, or can change from
one GCC release to another for the same set of optimizations.  The same
is true of any other compiler, for any kind of undefined behavior.

Janis


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