Vanilla Netrek Server Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[VANILLA-L:790] Use of 'register' declaration




While I was working on cambot, I came across a routine that declared
something like 10 variables as register.  All these variables were simple
loop iterators.  This irked me to no end, and I ended up removing all these
register declaration.  (The ones in the non-critical sections of genspkt.c
that were being used as loop iterators.)

Before I inflict my judgment on everyone else, I thought I would run
this past everyone.  I'm under the impression that 'register' is just
a bad leftover from C's heritage.  Am I mistaken?

The server is compiled (by default) with the optimize flag.  This causes
the compiler to create/rearrange/remove/register(ize) variables automaticly.
I know 'register' is only supposed to be a hint to the compiler, but I'm
not sure if this is always the case.  (A quick glance of gcc's info pages
speaks of variables being declared 'register' effecting it's volatility..)
Of course, I'm not a compiler expert.  The thing that bothered me,
was the sheer volume of register declarations.  Many architectures
dont have 10+ registers.  (Dont forget about the registers reserved for
frame pointers, kernel use, etc.)

Anyway, if there are objections to this, I will replace the register
declarations.

Of course, if someone is willing to enlighten me to the uses of register,
I would be grateful.

-- 
 ------------------------------------------------------------------------
 | Kevin O'Connor                     "BTW, IMHO we need a FAQ for      |
 | koconnor@acsu.buffalo.edu           'IMHO', 'FAQ', 'BTW', etc. !"    |
 ------------------------------------------------------------------------
+
++ Vanilla-l Mailing List ++
To unsubscribe: send "unsubscribe vanilla-l" to majordomo@real-time.com
For more information: http://archives.real-time.com


Follow-Ups: