Interpretation of volatile - two questions
Ronald Guilmette
rfg at paris.ics.uci.edu
Mon Mar 19 19:28:08 AEST 1990
Assume you have the following structure:
struct s {
char c1;
volatile char c2;
};
Now assume that you also have:
struct s *memory_mapped_device_p = (struct s *) 0xffffff80;
Now if you also have:
void foo ()
{
char c;
c = memory_mapped_device_p->c1;
}
does the standard (a) permit, (b) require, or (c) prohibit the assignment
statement shown to access the c2 field of the "struct s" pointed to by
memory_mapped_device_p?
This could be important in cases where you have certain locations which
(when read) produce side-effects.
// Ron Guilmette (rfg at ics.uci.edu)
// C++ Entomologist
// Motto: If it sticks, force it. If it breaks, it needed replacing anyway.
More information about the Comp.std.c
mailing list