Re: Is "register" generally ignored?

Ray Dillinger <>
21 Mar 2002 22:01:26 -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: Ray Dillinger <>
Newsgroups: comp.compilers
Date: 21 Mar 2002 22:01:26 -0500
Organization: Compilers Central
References: 02-02-067 02-03-014
Keywords: C, optimize
Posted-Date: 21 Mar 2002 22:01:26 EST

Fergus Henderson wrote:
> Scott Meyers <> writes:
> >Is it reasonable to assume that contemporary C and C++
> >compilers will ignore use of "register" when generating optimized code?
> Yes.

Although some compilers have a setting or compile flag that will make
them pay attention to the "register" directives.

I have used such options when compiling to C without benefit of the C
stack. Scheme, the language I compiled to C,does not have the same
stack discipline as C, so I was generating explicit stack-handling
code to put stack frames on the heap and link them to the
datastructures used by the garbage collector. From the perspective of
the C compiler, the code that had been produced was just one gigantic
routine with the stack-handling stuff inlined and occasional "gotos"
where the scheme source code was passing control from one routine to

Until I figured out how to get gcc to pay attention to the register
directive, I had to tell it not to optimize at all. Otherwise it was
trying to do graph-coloring on that monstrous routine to figure out
what variables should be enregistered -- a process that could make the
compile take years if the program being compiled was large.


Post a followup to this message

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