From: | schwarz@mips.complang.tuwien.ac.at (Konrad Schwarz) |
Newsgroups: | comp.arch,comp.compilers,comp.dsp |
Date: | 22 Mar 1996 00:04:05 -0500 |
Organization: | TU Wien |
References: | 96-03-006 96-03-091 96-03-111 |
Keywords: | optimize, performance |
The moderator writes:
| [...] are there still compilers that pay attention to register? -John
Perhaps someone can help me here. I always thought that the
main benefit of register in modern compilers is that it asserts
that the variable isn't aliased, since its address cannot be taken;
and not that the object should be held in a register during
its entire lifetime.
As far as I understand ANSI C, as soon as a char * pointer appears
in a function, any (non-register) object may be aliased by it.
In any case, the register keyword makes it immediately obvious to
the human reader that the variable is not aliased; it can be
used as documentation just like const.
Konrad Schwarz
[If you have an auto variable and never take its address, it can't be
aliased. Register does document your intent, but it doesn't tell the
compiler anything it can't figure out anyway. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.