Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 1999 00:18:53 -0500 (EST)
From:      Chuck Robey <chuckr@mat.net>
To:        Anthony Kimball <alk@pobox.com>
Cc:        chat@FreeBSD.ORG
Subject:   Re: Use of "register" in code
Message-ID:  <Pine.BSF.4.10.9903170012160.348-100000@picnic.mat.net>
In-Reply-To: <14063.12923.464399.183283@avalon.east>

index | next in thread | previous in thread | raw e-mail

On Tue, 16 Mar 1999, Anthony Kimball wrote:

> Firstly, removing "register" declarations from a program can
> cause correct code to become incorrect code.  This is true, not only
> of ANSI C, but of the GNU C 2 series compilers, as well as other
> significant current compilers, such as Microsoft and SunPro.
> 
> Secondly, producing such code is not easy, and it is very unlikely
> that any given use of the keyword in the source base will meet the
> necessary conditions to demonstrate this fact.
> 
> Thirdly, most instances of the keyword are not intentionally being
> used to produce ANSI semantics.  Instead, the author's intention was
> to effect the manual optimization of K & R's "register" keyword.  It
> is this intention which is justifiably belittled by the majority of
> commentators in this thread.
> 
> Finally, David O'Brien's quote from ANSI X3.159-1989 proves that
> Andrew O'Rielly's characterization of the meaning of "register"
> is fair and justified.

Most of what I've seen here is correct, you guys are seemingly pushing
your viewpoints.  You all basically agree with one another, but you want
to emphasize one little point.

OK, I'll raise my own little point, then/

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.

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?

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).


----------------------------+-----------------------------------------------
Chuck Robey                 | Interests include any kind of voice or data 
chuckr@glue.umd.edu         | communications topic, C programming, and Unix.
213 Lakeside Drive Apt T-1  |
Greenbelt, MD 20770         | I run picnic (FreeBSD-current)
(301) 220-2114              | and jaunt (Solaris7).
----------------------------+-----------------------------------------------






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



help

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