On 7 Oct 99, at 18:07, [EMAIL PROTECTED] wrote:
> On the other hand, I was under the impression that the C "register"
> keyword was intended as a suggestion to the compiler, not an absolute,
> i.e. that compilers should be free to heed or ignore the programmer's
> advice on this point. Looks like whether that's true depends on the compiler.
This is indeed true.
MS VC++ for Intel (at least up to v5.1) dedicates the ESI & EDI
registers for register variables, they are assigned to the first two
(integer) variables to be allocated in each block. It _does_ make
sense to use the 'register' keyword for the two innermost loop
counters (or pointers) because otherwise the object code generated by
the compiler doesn't use these registers at all (without pushing
their values to the stack & popping them off again, and only then for
those peculiar Intel instructions like MOVSB which implicitly use ESI
& EDI as pointers). If you declare more than two register variables
in a block, the (MS VC++) compiler ignores the register modifier for
the third & subsequent declarations.
This actually makes sense for a CPU architecture like 486 or "plain"
Pentium, but, for P6 architecture chips, experiments indicate that
the effects of the use of the "register" keyword in MS VC++ code are
variable, but (on average) about neutral.
Regards
Brian Beesley
_________________________________________________________________
Unsubscribe & list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ -- http://www.tasam.com/~lrwiman/FAQ-mers