Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Mar 1999 23:31:35 -0600 (CST)
From:      Anthony Kimball <alk@pobox.com>
To:        chuckr@mat.net
Cc:        chat@FreeBSD.ORG
Subject:   Re: Use of "register" in code
Message-ID:  <14063.15486.810437.3670@avalon.east>
References:  <14063.12923.464399.183283@avalon.east> <Pine.BSF.4.10.9903170012160.348-100000@picnic.mat.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoth Chuck Robey on Wed, 17 March:
: You seem to be conveniently forgetting the huge role the hardware plays.
: Let me see you get 3 register vars (in use) on an Intel platform.  On
: the Alpha I could see it (tho I wouldn't be surprised in any one case to
: see a compiler overrule you) but the resources are *so* short on the
: IA32, almost any register declaration is headed for the boneyard.

Aaaah!  Argggh!  I agree completely, but feel as though I've just been
talking to a brick wall.  What I tell you three times is true.

"register" qualifier != CPU register.
"register" qualifier != CPU register.
"register" qualifier != CPU register.

: Well.  It won't hurt to use it, if you're extremely sophisticated, but
: for most people it's a big mistake to use it, especially if you follow
: any of the example code written in the last 20 years.  Is that right?

Aside from being founded upon a mistaken world view, your conclusion
is absolutely and precisely correct.

: And if you know enough to use it right, you're probably going to rely on
: the compiler anyhow (if you need the speed, you'll use assembler
: anyhow).

Using it *correctly* *is* relying upon the compiler.  You are
providing new semantic information to the compiler which permits it to
perform optimizations that may nothing to do with the idea of keeping
the value in a CPU register other than using the keyword which
historically was used to perform this manual optimization.  ANSI
'register' is arguably more like ANSI 'const' than it is like K & R's
'register'.





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14063.15486.810437.3670>