A glitch for "register"
T. William Wells
bill at twwells.uucp
Wed Jan 18 06:50:11 AEST 1989
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
More information about the Comp.std.c
mailing list