Re: Is this a bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Honggang Xu wrote:
> Or my understand of keyword "volatile" is wrong, following code outputs
> compiled by gcc 4.1.1:  x=22 ,y=59
>  
> main()
> {
> volatile int  x=20,y=35;
> x=y++ + x++;
> y= ++y + ++x;
> printf("x=%d  y=%d\n" ,x,y);
>  
> }

No, it's not a gcc bug: your program exhibits undefined behaviour.

http://c-faq.com/expr/ieqiplusplus.html

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux