Related articles |
---|
Is "register" generally ignored? smeyers@aristeia.com (Scott Meyers) (2002-02-28) |
Re: Is "register" generally ignored? {spamtrap}@erewhon.demon.co.uk (Maneki Neko) (2002-03-09) |
Re: Is "register" generally ignored? fjh@cs.mu.OZ.AU (2002-03-09) |
Re: Is "register" generally ignored? rkrayhawk@aol.com (2002-03-09) |
Re: Is "register" generally ignored? bear@sonic.net (Ray Dillinger) (2002-03-21) |
From: | Scott Meyers <smeyers@aristeia.com> |
Newsgroups: | comp.compilers |
Date: | 28 Feb 2002 00:13:44 -0500 |
Organization: | Scott Meyers |
Keywords: | C, C++, optimize, comment |
Posted-Date: | 28 Feb 2002 00:13:44 EST |
For several years, I have assumed that optimizing compilers for C and
C++ routinely ignored programmer use of the "register" keyword,
preferring instead to apply graph coloring or related algorithms to
determine "optimal" register allocation (where "optimal" means "almost
certainly at least as good as the programmer would do themselves and
probably better"). I figured it was time to check this assumption by
at least asking other people who probably know more than I. Hence
this message. Is it reasonable to assume that contemporary C and C++
compilers will ignore use of "register" when generating optimized
code?
Thanks,
Scott
PS - I'm talking here only about the effect of "register" on generated
code. I know that declaring a variable "register" imposes front end
restrictions, such as not being able to take the variable's address, but I
don't care about front end issues.
--
Check out the *new* "THE C++ Seminar,"
http://www.gotw.ca/cpp_seminar/
[I hope that compilers at least remember that register variables don't
have addresses, so there's no aliasing problems. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.