Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 1999 20:31:41 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        "Andrew Reilly" <andrew@lake.com.au>
Cc:        "Stephen J. Roznowski" <sjr@home.net>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Use of "register" in code
Message-ID:  <199903160431.UAA05835@apollo.backplane.com>
References:  <199903160333.WAA06493@istari.home.net> <199903160349.TAA05543@apollo.backplane.com> <19990316151744.A39973@reilly.home>

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

:> :
:> :Thanks,
:> :-- 
:> :Stephen J. Roznowski    (sjr@home.net)
:> 
:>     The register declarations are useless historical artifacts.
:
:Why do you say that?  "register" in a declaration has a specific
:semantic meaning that isn't (to my knowledge) duplicated by any
:other language mechanism, and that is "this variable does not exist
:in the memory space, and so _cannot_ be de-referenced with "&" or
:modified by an asignment through a pointer."  Register pointer
:variables and temporaries are very important for preventing C
:compilers from producing pessimistic inner loop code.
:
:-- 
:Andrew

    Firstly, that is not what register means.  Secondly, all modern C 
    compilers that I know about, including one I wrote years ago, can 
    trivially detect the stack locality of a variable and put it in a
    register as part of standard optimizations.   It's one of the *easiest*
    optimizations a C compiler can do, in fact.

    Some compilers will add a little weight to the potential optimization
    if you use the 'register' keyword, but modern compilers tend to do a
    better job without the manual weighting.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>



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




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