unary +

Walter Bright bright at dataioDataio.UUCP
Thu Apr 10 04:16:35 AEST 1986


In article <687 at bentley.UUCP> kwh at bentley.UUCP (KW Heuer) writes:
>[3]  Someone proposed using "a+(volatile)(b+c)".  I think this is workable,
>though not quite the same meaning as volatile applied to a simple variable.

Not even close! 'volatile' means to the compiler:
	o The value of the variable can change anytime (asynchronously),
	  and the value can be read anytime (asynchronously) independently
	  of the executing program (such as an I/O port register). The
	  ramifications of this are from the compiler's perspective:
		1) Do not remove redundant reads of the variable.
		2) Do not remove dead assignments to the variable.

Producing another definition which means:
	o Do not reorder the expression.

is a totally distinct meaning. I'm totally against such overloading of
the meaning of 'volatile'. It makes about as much intuitive sense as:
	"a+(while)(b+c)"
which is also easily implementable, but very confusing.

For all of those of you out there who were confused by the two distinct
meanings of the keyword 'static', speak up!
(By the way, the meanings of static are:
	1. If outside the scope of a function, do not make the symbol global.
	2. If inside the scope of a function, allocate storage in
	   the data segment instead of on the stack.
)

-- Row well, and live. --



More information about the Comp.lang.c mailing list