Order of registers

braner at batcomputer.UUCP braner at batcomputer.UUCP
Tue Feb 17 16:20:28 AEST 1987


In article <4141 at utcsri.UUCP> flaps at utcsri.UUCP (Alan J Rosenthal) writes:

>	f(nformal)
>	int nformal;
>	{
>		register int i,n = nformal;

>, which is often recommended, wastes an int on all machines.

"Wastes an int"???  - nformal is on the stack anyway, so if you use
"register" before the '{' the compiler copies it to a register.
Therefore the code above is IDENTICAL in effect - but leaves the
ORDER of "register" assignments up to the programmer.

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.

- Moshe Braner



More information about the Comp.lang.c mailing list