'register' type (was: bit-field pointers / arrays)

Eric Black eric at cti.UUCP
Sat Jan 10 02:57:33 AEST 1987


In article <1923 at batcomputer.tn.cornell.edu> braner at batcomputer.UUCP (braner) writes:
>
>The C programmer is currently free to avoid declaring variables 'register',
>in the hope that the compiler is smart enough to do it optimally.  Also, if
>'register' IS used (with reason), it should not hamper the smart compiler.
>
>On the other hand, lots of present and future compilers are NOT that smart.
>Also, there will always be SOME cases where a tricky algorithm eludes the
>compiler's smarts.
>

The algorithm doesn't even need to be very tricky.  I expect it would
be quite difficult or impossible for even a smart compiler to be able
to determine program behavior (hence what needs to be optimized) without
any knowledge of the environment (including input data) in which it will
be used.  This is the old distinction between static and dynamic analysis.
The programmer can use the "register" attribute to advise the compiler that
he expects the dynamic behavior of the program to make it desirable for that
variable to reside in a register, even though the static appearance of the
code might not make this apparent.

>The 'register' tool can be VERY valuable, and is one of endearing features
>of C.  Don't dump it!

Hyuh, hyuh!

[first posting from this site using news 2.11 software...]
-- 
Eric Black   "Garbage In, Gospel Out"
UUCP:        {sun,pyramid,hplabs,amdcad}!cti!eric



More information about the Comp.lang.c mailing list