avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] OT Generic C question


From: Nils Springob
Subject: Re: [avr-gcc-list] OT Generic C question
Date: Tue, 20 Sep 2005 16:08:01 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

Hi,

In C the result of this expression is undefined. The C language defines that the compiler is allowed to increment the variable i before or after the assignment operation.
h=i++ is valid C, h will have the old value of i, i will be incremented.
i=i++ is invalid C, the value of the variable i will be i or i+1 after execution of this expression, depending on the compiler.

Regards,
Nils

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;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]