I stumbled at an assignment that
"How do we get to know whether variable stored in register or not, programmatically ?"
Please give me any idea, If anyone already done this one.
Thanks in Advance
Srikanth Dhondi
I stumbled at an assignment that
"How do we get to know whether variable stored in register or not, programmatically ?"
Please give me any idea, If anyone already done this one.
Thanks in Advance
Srikanth Dhondi
Last edited by dhondi; 11-03-2009 at 12:29 PM.
There is a storage class specifier called register, but as far as I know that only works as a suggestion for the compiler, ie it may not be stored in a register anyway.
The only way of knowing it is looking at the assembly of the compiled code. It is impossible to do programatically, if it means finding out so via code. Remember that C knows nothing about the process architecture or its registers. It is simply a high-level language that is translated into instructions for the cpu.