[comp.std.c] A glitch for "register"

bill@twwells.uucp (T. William Wells) (01/18/89)

I just noticed something. The dpANS (May 88) says that `&' can't be
applied to a register variable. However, it does not say, except in a
footnote, that

	register int a[4];

	a[0] = 0;

is illegal. And footnotes are not part of the standard.  This is an
obvious oversight, parhaps fixed in the latest? (Or perhaps I just
miseed where they said it?)

However, that is not the glitch I had in mind. Consider this:

	register struct {
		int     foo;
	} bletch;
	int     *ptr;

	ptr = &bletch.foo;

It does not seem to violate the standard, though obviously it should.

Here is what the May 88 standard says: (3.3.3.2)

"The operand [of &] ... shall be ... an lvalue that designates an
object that ... is not declared with the register storage-class
specifier."

It seems to need an additional clause saying something like "and is
not contained within an object declared with the register
storage-class specifier".

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