[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] OT Generic C question
From: |
Alexandru Csete |
Subject: |
Re: [avr-gcc-list] OT Generic C question |
Date: |
Tue, 20 Sep 2005 13:22:18 +0200 |
On 9/20/05, Trampas <address@hidden> wrote:
> 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
>
i=i++ is somehow ambigous.
The statement i++ means "use the value of i then increment it", while
++i means "increment i then use the value". Thus, there is no need to
write i=i++. Use:
i++;
or
++i;
or
i = i+1;
> 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
>
Alex
- Re: [avr-gcc-list] OT Generic C question, (continued)
- Re: [avr-gcc-list] OT Generic C question, David Brown, 2005/09/20
- RE: [avr-gcc-list] OT Generic C question, Trampas, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Dave Hansen, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Richard Urwin, 2005/09/22
- Re: [avr-gcc-list] OT Generic C question, Alan Kilian, 2005/09/22
- Re: [avr-gcc-list] OT Generic C question, Dave Hansen, 2005/09/22
- Re: [avr-gcc-list] OT Generic C question, Richard Urwin, 2005/09/22
- Re: [avr-gcc-list] OT Generic C question, Dave Hansen, 2005/09/22
- Re: [avr-gcc-list] OT Generic C question,
Alexandru Csete <=
- 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, 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, Joerg Wunsch, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Jeff Barlow, 2005/09/20