J
junky_fellow
what is the purpose of declaring a register variable ?
why can't we find the address of register variable ?
why can't we find the address of register variable ?
what is the purpose of declaring a register variable ?
why can't we find the address of register variable ?
what is the purpose of declaring a register variable ?
why can't we find the address of register variable ?
what is the purpose of declaring a register variable ?
why can't we find the address of register variable ?
Arafangion said:Register variables are *insanely* fast, in a nutshell.
I would assume that you can't find the address of a register variable on
the basis that they do not *have* an address, it simply is 'register
number 2', from what little.
Normal RAM is many, many times slower, in comparison.
what is the purpose of declaring a register variable ?
why can't we find the address of register variable ?
what is the purpose of declaring a register variable ?
why can't we find the address of register variable ?
Meghavvarnam said:To add to Pete here is what I have to say :
1. Declaring a register variable, suggests the compiler to use a
register on the processor exclusively for that variable and hence
access to this variable becomes incredibly fast.
Jonathan Bartlett said:Registers are part of the CPU, not memory. Therefore, registers do
not have a memory address.
what is the purpose of declaring a register variable ?
why can't we find the address of register variable ?
Ben Pfaff said:This is usually but not always true. Some CPUs put the registers
into addressable memory.
To add to Pete here is what I have to say :
1. Declaring a register variable, suggests the compiler to use a
register on the processor exclusively for that variable and hence
access to this variable becomes incredibly fast.
2. Any register on the processor is identified by its respective name
unlike memory locations on RAM that have addresses. To know the
registers on a given processor, please look at the processor manuals. I
dont know if they are available online. Am sure they should be.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
There is no purpose nowadays. The compiler can do a much better
analysis of which variables would benefit from being stored in a
register.
<posted & mailed>
It's a hint to the compiler that you think this variable is going to be
accessed frequently, so you'd like it stored in a CPU register rather than
in memory.
CPU registers don't have addresses.
Jaspreet said:I also think that we can only have integer variable stored in a
register. I think float or double cannot be stored on a register.
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.