[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] OT Generic C question
From: |
Mike Murphree |
Subject: |
RE: [avr-gcc-list] OT Generic C question |
Date: |
Tue, 20 Sep 2005 08:38:38 -0500 (CDT) |
User-agent: |
SquirrelMail/1.4.4 |
Ron said:
>> 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
>
> Not exactly the gold standard, but Microsoft C7 gives the
> expected 1, whereas AvrGcc gives 0, So could be a gcc bug.
The increment should take place after the assignment, but I would have
expected the increment to happen before any other operation. How was he
verifying what the new value was (e.g. debugger, printf, etc) and when?
Of course, it would have been a lot simpler to just use: i++;
Mike
- Re: [avr-gcc-list] OT Generic C question, (continued)
- 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
- 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 <=
- Re: [avr-gcc-list] OT Generic C question, Alexandru Csete, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Mike Murphree, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Wolfgang Wegner, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Anton Erasmus, 2005/09/20
- Re: [avr-gcc-list] OT Generic C question, Nils Springob, 2005/09/20
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, David Kelly, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, David Kelly, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/19
- Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?, Vincent Trouilliez, 2005/09/19