By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,434 Members | 1,878 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,434 IT Pros & Developers. It's quick & easy.

verifycation of registed variable

P: n/a
hi everyone, i'm wondering if there is a way to have sure that a
variable is allocated in the cache, after its declaration with
"register"? Tks!

Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
or*****@gmail.com wrote:

hi everyone, i'm wondering if there is a way to have sure that a
variable is allocated in the cache, after its declaration with
"register"? Tks!


No.
The one and only guaranteed effect of the register keyword,
is that the address of a register classed object
can't be determined by the program.

--
pete
Nov 15 '05 #2

P: n/a
or*****@gmail.com writes:
hi everyone, i'm wondering if there is a way to have sure that a
variable is allocated in the cache, after its declaration with
"register"? Tks!


Not in standard C, and not using any extension I've ever heard of.

You posted the same question twice, with different subject headers,
about 6 minutes apart. Please don't do that.

Typically the compiler is the best judge of whether a variable should
be in a register, and interfering with its judgement with the
"register" keyword can be counterproductive.

Cache is something else; it's typically managed at execution time by
the hardware and/or the operating system. The whole point of cache is
that it looks like ordinary memory, except that it's faster. If the
compiler obeys the "register" keyword, the variable will be in a
register, *not* in cache.

Just what are you trying to accomplish?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.