Order of registers

chris at mimsy.UUCP chris at mimsy.UUCP
Wed Feb 18 17:52:56 AEST 1987


>In article <4141 at utcsri.UUCP> flaps at utcsri.UUCP (Alan J Rosenthal) writes:
>>	f(nf) int nformal; { register int n = nformal;
>>, which is often recommended, wastes an int on all machines.

Not all!

In article <195 at batcomputer.tn.cornell.edu>
braner at batcomputer.tn.cornell.edu (braner) writes:
>"Wastes an int"???  - nformal is on the stack anyway,

Is it?  (Have a care with that answer!  Try some different compilers
on some different architectures.)

>I support the K&R method of the compiler following the programmer's
>order until registers are used up.  After all, C is supposed to give
>the programmer as much control of the machine as possible.

I would not put it that way.  Say rather that C is not supposed to
obstruct control of the machine.  On conventional (PDP-like)
machines, with conventional (straightforward, unoptimising) compilers,
this does seem to be the best thing to do with `register' declarations.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris at mimsy.umd.edu



More information about the Comp.lang.c mailing list