Just a quick question, if i declare a variable like this: registerint i;
As far as i know register is just a request for compiler.
So how do i know if it is really placed in cpu register?
Thanks in advice.
There is no programmatic way to know this. Typically you can easily figure it out by loading the
program into a debugger, running until the variable in question comes into scope, then using
the debugger to print out the contents of the variable. If the variable got optimized out (into a
register), the debugger will either complain about the symbol not being found or will outright tell
you it got optimized out.