Volatile global variable

Chris Torek torek at elf.ee.lbl.gov
Fri Mar 22 10:00:37 AEST 1991


In article <1991Mar21.160849.1520 at b8.ingr.com> harbis at b8.ingr.com
(Randy Harbison) writes:
>	Example: A pointer which is pointing to the address of the
>		 system clock.  This variable would change in relation to
>		 the clock in runtime.  (I am specifically interested
>		 in the variable incrementing as the seconds increase).
>	1. What TYPE would the variable be?
>	2. How would I find the address of the clock (seconds)?
>	3. How would I assign the variable to the clock's address?
>	4. If I'm way out in left field, what would be the reasonable options?

Well, you are definitely way out in machine-dependent territory (though us
southpaws think `left field' is normal :-) ).  Questions 1 through 3
*require* machine details in order to be answered.  You have given none,
and comp.lang.c is not the proper newsgroup for them anyway, so what
you need to do is decide which machine(s) you need answers for and
find appropriate machine-specific newsgroups.

ANSI C provides the `volatile' qualifier specifically as an escape hatch
to do this sort of thing, but (of necessity) does not pin down exactly
what `volatile' does.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list