May too many register variables hurt? (was Re: Novice question.)

Doug Gwyn gwyn at smoke.brl.mil
Wed Nov 21 04:42:01 AEST 1990


In article <967 at mwtech.UUCP> martin at mwtech.UUCP (Martin Weitzel) writes:
>In general, my advice is to use no more than two register variables, and
>only in the *outmost* blocklevel in the body of any function.

Mine is the opposite.

>The order in which the variables are declared is a-b-c, so c will not
>profit from its storage class.

Sure it will.  Since b and c are declared in separate parallel blocks,
older-technology compilers such as PCC will share the explicit register
that is assigned for these two variables.  This is in fact a good way
to exploit "register" in such compilers.



More information about the Comp.lang.c mailing list