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]

Re: scope issue



sometime in the late 1900s Dima replied to Richard:

> Richard Harvey Chapman wrote:
> 
> > Is there a correct output for the following?
> 
> No, there isn't.


i can understand your answer for the second printf() but not
for the first one.

i think the first one should always give 9 (in this case).

what am i missing?


> > int main ( void )
> > {
> >   int x=9;
> >
> >   printf ("%d\n", (x + x++) - --x);
> >   printf ("%d %d\n", ++x, x++);
> > }
> >
> > I believe that it should be:
> > 9
> > 10 10
> >
> > but different compilers have given different answers.
> >
> > R.
> 
> Dima




patrick at boxsoft dot com
sidster at drink dot com

--
The rain it raineth on the just
        And also on the unjust fella,
But chiefly on the just, because
        The unjust steals the just's umbrella.


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