A different view of volatile

Karl Heuer karl at haddock.ISC.COM
Wed Apr 27 07:01:29 AEST 1988


In article <7996 at pur-ee.UUCP> hankd at pur-ee.UUCP (Hank Dietz) writes:
>Instead, why not use "register" to solve the [volatile] problem....

Currently, "break" has two (or maybe one and a half) meanings, "static" has
two meanings, and "void" has three.  I'd rather not see "register" achieve a
similar overloading, which is what I see in your proposal.

>[a register object cannot be volatile]

But the converse is false.  I use non-volatile non-register objects all the
time.

Also, your proposal breaks the rule of defaulting to the most common case.
Most programs don't need *any* volatile declarations, and of those that do,
most objects are *not* so qualified.  This is why X3J11 invented "volatile"
rather than "novolatile".

>register static double d[100];

How does the register-nonaddressibility rule interact with the automatic decay
of the array expression "d" into the pointer "&d[0]"?  You'd need to define
the rules very carefully to make this declaration useful.

>char *strcpy(char register *p, register *q;) { ... }

Minor nit: types don't propagate in a function prototype; you need "char" in
both declarations.  And no semicolon.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list