Is "register" generally ignored?

Scott Meyers <>
28 Feb 2002 00:13:44 -0500

          From comp.compilers

Related articles
Is "register" generally ignored? (Scott Meyers) (2002-02-28)
Re: Is "register" generally ignored? {spamtrap} (Maneki Neko) (2002-03-09)
Re: Is "register" generally ignored? (2002-03-09)
Re: Is "register" generally ignored? (2002-03-09)
Re: Is "register" generally ignored? (Ray Dillinger) (2002-03-21)
| List of all articles for this month |

From: Scott Meyers <>
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



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,"
[I hope that compilers at least remember that register variables don't
have addresses, so there's no aliasing problems. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.