register variables

Dick Dunn rcd at opus.UUCP
Thu Jul 4 10:49:33 AEST 1985


> I have to admit to getting into the sloppy habit of stopping after
> six register declarations.  But that's not why I'm writing this.
> . . what I really want to do is make another point here, and that
> is that you should declare register variables before ordinary
> variables (in general), since some machines (Pyramids) ignore the
> word ``register'' and just put the first N (12) variables in
> registers.  (Such a machine must, of course, be able to take the
> address of a register.)

Sounds like the Pyramid compiler has a problem there, to the extent that
it's not following the spirit of the `register' declaration.  Who ever said
that "order of declaration" is a hint to the compiler on which variables
are most frequently used?!

Also, it's not generally possible to declare register variables before
ordinary variables--parameters are effectively just initialized local
variables, but the syntax requires that they all be declared before any of
the locals.  The parameter-vs-local distinction is another reason that
compilers ought not to do what the Pyramid compiler is described as doing.
-- 
Dick Dunn	{hao,ucbvax,allegra}!nbires!rcd		(303)444-5710 x3086
   ...A friend of the devil is a friend of mine.



More information about the Comp.lang.c mailing list