Re: A basic question question about volatile use
- From: Joe Wright <joewwright@xxxxxxxxxxx>
- Date: Thu, 31 Jul 2008 17:05:51 -0400
Ark Khasin wrote:
I have a memory-mapped peripheral with a mapping like, say,
struct T {uint8_t read, write, status, forkicks;};
If I slap a volatile on an object of type struct T, does it guarantee that all accesses to the members are byte-wide, or is the compiler free
to read or read-modify-write in any data width it chooses?
Is slapping a volatile on each member of the struct definition any different? better? worse?
I guess you don't have a decent C book. The point of 'volatile' is to tell the compiler that this variable might be modified by forces outside this program's scope. Think memory-mapped I/O.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
.
- References:
- A basic question question about volatile use
- From: Ark Khasin
- A basic question question about volatile use
- Prev by Date: Re: Which is faster?
- Next by Date: Re: diagnostic message
- Previous by thread: Re: A basic question question about volatile use
- Next by thread: file deletion in a directory with some conditions .
- Index(es):
Relevant Pages
|