Since we're talking about history, I'm referencing the C89 standard...
Originally Posted by C89 3.5.1
register still "does what it's supposed to do", which is suggest the compiler make it as fast as possible. The limit of how many register variables you could use effectively was architecture dependent. The SPARC architecture used by Sun had 8 global general purpose registers and 8 local general purpose registers per frame (they had a sexy sliding-frame setup for function calls). The compiler could possibly put 16+ variables in registers.
Originally Posted by nonoob
Determining the address of a register variable is expressly prohibited, which makes perfect sense since it might not be in memory and thus has no address:
If there were oddball address aliasing, the compiler would have noticed it and provided sufficient code to propagate the value into real RAM (from the register) as required. Unless you can point to specific compilers which had known bugs in this regard.
As an aside, could you compile your example Tater? What compiler are you using? GCC wouldn't let me...
Originally Posted by C89 standard footnote 49
Doubtful. Compiler writers are pretty awesome coders and their optimizations are generally much faster, but not knowing the intent of your code, they can only optimize so much. It's quite possible that you have some intricate knowledge of your algorithm and know you want a specific variable in a register, thus I would wager most decent compilers do their darnedest to honor the keyword, assuming that if you use it, you know what you're doing. Indeed, GCC (v4.4.4) translated the following two declarations differently:
The reference book that was referred to may be out-of-date with today's much more optimizing compilers. Perhaps the keyword 'register' has just been left over for backward compatibility...
gcc -S foo.c
int x = 5;
register int y = 10;
printf("x: %d\n", x);
printf("y: %d\n", y);
movl $5, 28(%esp) ; this is x, referenced from the stack pointer
movl $10, %ebx ; this is y, stored directly in a register