top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

When a programmer should use register variable and when not to use register variable?

+2 votes
149 views
When a programmer should use register variable and when not to use register variable?
posted Nov 10, 2014 by Ganesh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

I think a programmer should use register variable where time is a constraint.

The reason behind this is that reading/writing data from/to the CPU internal registers is faster compared to RAM.

So in a real time application where every microsecond counts, it is better to use a register variable.

Added info: The formal arguments of a function are of register storage class type.

answer Nov 17, 2014 by Ankush Surelia
Similar Questions
+1 vote

In large product based companies LLD is written by senior team members and developers write the code.
Does the senior team member decide what data type they should use in advance ? If yes then what things derives type of data for example. How they decide a variable should be declared as volatile ? and what would be advantage of having a variable volatile and what could be the problem if it is taken without the volatile ?

+3 votes

Sometime, I get confused which one I should take while writing code.
Is there any way, which can be help me while choosing either switch-case or if-else ?

...