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

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

Re: [avr-gcc-list] Question about gcc preprocessing andport/pinassignmen


From: David Brown
Subject: Re: [avr-gcc-list] Question about gcc preprocessing andport/pinassignments
Date: Fri, 10 Dec 2004 16:22:11 +0100

> From: David Kelly <address@hidden>
> >
> >On Dec 9, 2004, at 7:43 PM, Dave Hylands wrote:
> >
> >>In the example I showed, a = ( b = 3 ) + 4; we know that a will be
> >>assigned 7 and b will be assigned 3. We don't know the order that these
> >>assignments will take place in.
>
> It's worse than that.  Given
>
>    b = 3;
>    a = b + 4;
>
> we don't know in which order the assignments will take place.  Unless 'a'
> and 'b' are volatile.
>

There is a big difference - in the "a = (b = 3) + 4" case, we don't know the
order of the assignments *even if they are volatile*.  In the second case,
we know the order if they are volatile, and if they are not volatile, then
who cares?  C does not specify that a and b have to be assigned to at all -
in fact, they don't have to exist in the generated code at all if they are
local.  All the compiler needs do is generate code that will function as
though the two statements we executed in the given order.





reply via email to

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