volatile registers (was: The world is not ready for 'volatile')

T. William Wells bill at twwells.uucp
Thu Jan 12 00:38:33 AEST 1989


In article <54573 at pyramid.pyramid.com> wendyt at pyrps5.UUCP (Wendy Thrash) writes:
: In article <298 at twwells.uucp> bill at twwells.UUCP (T. William Wells) writes:
: >To alias something, one must have its
: >address.  Registers can't have their addresses taken. Therefore
: >register variables can't be aliased. QED.
:
: If the above is a statement about register variables in standard-conforming C
: programs, it may be true; if it's a statement about computer hardware, it
: is false.  On Pyramid hardware, for example,  one is quite free to take the
: addresses of registers (though it takes a couple of instructions to do so).
: Our current implementation of C also allows taking the address of a register
: variable, remarking as it does that,
: "warning: taking the address of a register variable is not portable".
:
: We now have a proof and a counterexample.

It's about register variables in a standard-conforming program.

I know of one machine where registers are indistinguishable from a
certain area of memory. One could even store instructions in the
registers and branch there!  And on several micro compilers, register
is interpreted to mean "put this into fast memory" (they don't have
any registers useful for storing C variables).

---
Bill
{ uunet!proxftl | novavax } !twwells!bill



More information about the Comp.std.c mailing list