volatile (in comp.lang.c)

Chris Torek chris at mimsy.UUCP
Tue Jun 7 19:42:51 AEST 1988


In article <13249 at shemp.CS.UCLA.EDU> casey at admin.cognet.ucla.edu
(Casey Leedom) writes:

(Hi Casey.  What are you doing at UCLA?)

>>	volatile char * z80sio_rr0; ...

>Does it mean that the char pointers z80sio_rr0 ... [is] volatile, or does
>it mean that the char's pointed to ... are volatile?  Obviously for this
>example the second interpretation is what is desired, ....

Yes; and that is what it means.

>... then how would I declare a pointer to some object type, say char,
>with the intent that the pointer itself was volatile?

	char *volatile p;

The form `volatile char *p' is the same as `char volatile *p'.  I once
suggested (mostly unseriously) that `?' be used for `volatile', and `='
for const/readonly, so that one would write instead

	char ?*pointer_to_volatile_characters;
	char *?volatile_pointer_to_characters;
	char ?*?volatile_ptr_to_volatile_chars;

and things like

	int ?* =clockaddr = (int ?*)CLOCK_ADDR;
	/* readonly pointer to volatile int */

and

	char =rom_string[] = "foo baroo";

And you thought

	int (*(**(*foo(int a, int b))(long))[3][4])(char *) {

was bad...!
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list