verifycation of registed variable

O

orium69

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!
 
P

pete

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.
 
K

Keith Thompson

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top