Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Mar 1999 22:55:18 -0600 (CST)
From:      Anthony Kimball <alk@pobox.com>
To:        chat@freebsd.org
Subject:   Re: Use of "register" in code
Message-ID:  <14063.12923.464399.183283@avalon.east>

next in thread | raw e-mail | index | archive | help

> >     I doubt it would make performance worse.  I think GCC basically just
> >     ignores it for IA32.

> It does ignore it.  

This is categorically wrong.  GCC does not ignore "register"
declarations.  It honors the ANSI standard C semantics for
register-qualified types in at least some circumstances, even without
supplying -ansi or -pedantic options.  I just tried it.

> ... the compiler knows more
> about temporaries and other usage than the programmer.  Most of the time
> (but not all of the time), that is true.

This is certainly correct, but is beside the point, which illustrates
the danger of the "register" keyword:  Even experienced expert users
who have not specialized in compilers or language semantics are
decieved by the fact that the semantics of "register" in the ANSI
dialect bear only a passing relationship to the ordinary technical
use of the English word.

I would like to make several points which this discussion has obscured
to date: 

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.






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