[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] OT Generic C question
From: |
Lev Vyskubov |
Subject: |
Re: [avr-gcc-list] OT Generic C question |
Date: |
Tue, 20 Sep 2005 16:39:08 +0400 |
Здравствуйте, Trampas.
Вы писали 20 сентября 2005 г., 14:41:22:
> I was helping a friend debug some code, he is new to C, using the Keil
> version of GCC for ARM. Anyway I found the following:
> int i;
> i=0;
> i=i++;
> //i was still zero that
> That is i=i++ never incremented i, now I would have thought the line would
> be the same as:
> i=i;
> i=i+1;
> So you guys are the smartest people I know when it comes to C so I thought I
> would ask you guys if this is a compiler bug or is my understanding of C
> just been shaken.
> Regards,
> Trampas
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
I think it is NOT a bug. Possibly this code is work in such way:
1. Internal variable (accumulator) is set equal to value of i.
2. Value of i is incremented.
3. Value of i is set equal to value of accumulator.
This is possible logic of compiler and it is right.
--
С уважением,
Лев Выскубов mailto:address@hidden
- Re: [avr-gcc-list] OT Generic C question, (continued)
- Re: [avr-gcc-list] OT Generic C question, Dave Hansen, 2005/09/22
- Re: [avr-gcc-list] OT Generic C question, Alexandru Csete, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Wolfgang Wegner, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Julius Luukko, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Marc Wetzel, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Russell Shaw, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, varsha, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question,
Lev Vyskubov <=
- Re: [avr-gcc-list] OT Generic C question, David Kelly, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Christopher X. Candreva, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Joerg Wunsch, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Jeff Barlow, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, David Kelly, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Christopher X. Candreva, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Brian Sidebotham, 2005/09/20
- RE: [avr-gcc-list] OT Generic C question, Ron, 2005/09/20
- RE: [avr-gcc-list] OT Generic C question, Mike Murphree, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Alexandru Csete, 2005/09/20