[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Question about gcc preprocessing and port/pin assignm
From: |
Dave Hylands |
Subject: |
RE: [avr-gcc-list] Question about gcc preprocessing and port/pin assignments |
Date: |
Wed, 8 Dec 2004 17:05:47 -0800 |
Hi Richard (and Eric),
> If the programmer cannot protect against a problem then the
> compiler has to provide the tools to do it. It seems
> common-sense to me that that tool is 'volatile'.
The language definition (ANSI K&R book) actually doesn't have much to
say about volatile except this (section A8.2 Type Specifiers)
"The purpose of volatile is to force an implementation to
suppress optimization that could otherwise occur"
And also later in the same paragraph:
"Except that it should diagnose explicit attempts to change
const objects, a compiler may ignore these qualifiers".
ISO99 clarifies volatile quite a bit and adds:
"At sequence points, volatile objects are stable in the sense
that previous accesses are complete and subsequent accesses have not yet
occurred."
The gist of ISO99 basically only specifies what volatiles should look
like at the sequence points.
On assignment, ISO99 has this to say (Section 6.5.16 Assignment
operators, item 2):
"An assignment operator stores a value in the object designated
by the left operand. An
assignment expression has the value of the left operand after the
assignment, but is not an
lvalue. The type of an assignment expression is the type of the left
operand unless the
left operand has qualified type, in which case it is the unqualified
version of the type of
the left operand. The side effect of updating the stored value of the
left operand shall
occur between the previous and the next sequence point."
So the language really only specifies what the value of the variable is
at the sequence point, and not in between sequence points.
P.S. For anyone looking for a copy of the ISO99 spec, I found a copy
over here:
http://www.sics.se/~pd/ISO-C-FDIS.1999-04.pdf
I have no idea which version this is.
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
- Re: [avr-gcc-list] Question about gcc preprocessing and port/pin assignments, (continued)
RE: [avr-gcc-list] Question about gcc preprocessing and port/pin assignments,
Dave Hylands <=
- Re: [avr-gcc-list] Question about gcc preprocessing and port/pin assignments, Graham Davies, 2004/12/09
- Re: [avr-gcc-list] Question about gcc preprocessing and port/pin assignments, Jeff Barlow, 2004/12/09
- Re: [avr-gcc-list] Question about gcc preprocessing and port/pinassignments, Graham Davies, 2004/12/09
- Re: [avr-gcc-list] Question about gcc preprocessing and port/pinassignments, Jeff Barlow, 2004/12/09
- Re: [avr-gcc-list] Question about gcc preprocessing and port/pinassignments, E. Weddington, 2004/12/09
- Re: [avr-gcc-list] Question about gcc preprocessing andport/pinassignments, Graham Davies, 2004/12/09
- Re: [avr-gcc-list] Question about gcc preprocessing andport/pinassignments, Jeff Barlow, 2004/12/09
- Re: [avr-gcc-list] Question about gcc preprocessing andport/pinassignments, Ben L. Titzer, 2004/12/09
- Re: [avr-gcc-list] Question about gcc preprocessingandport/pinassignments, Graham Davies, 2004/12/09
Re: [avr-gcc-list] Question about gcc preprocessing and port/pinassignments, Dave Hansen, 2004/12/09