top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What are register variables in C++?

+3 votes
51 views
What are register variables in C++?
posted Mar 25, 2014 by Ashwini Miraj

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

Automatic variables are stored in the memory. As accessing a memory location takes time (much more time than accessing one of the machine's registers), one can make the computer to keep only a limited number of variables in their registers for fast processing.Whenever some variables are to be read or repeatedly used, they can be assigned as register variables.

answer Mar 26, 2014 by Yogeshwar Thakur
Similar Questions
+5 votes

What are register variables? What are the advantages of using register variables?

+1 vote

Are automatic variables (that are defined in functions, lambdas, blocks) in C++11 thread local? Is the following code correct:

auto f1 = [
 SomeClass1 obj1;
 double z = obj1.f2(y);
 return cos(z);
}

// Some function which creates several threads which call f1.
calculate_parallel(f1);

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...