Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Where should we use register keyword?

Status
Not open for further replies.

sagar474

Full Member level 5
Joined
Oct 18, 2009
Messages
285
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,318
Location
India,kakinada
Activity points
3,122
register char special;
register short int i=0,a=0;
register short int c;

I used these 4 register variables in my code. Is this helps to speed up my program?

how many register variables that i can use? register key word all owes reserve a register for the program?
 

Re: Where should we use rigester keyword?

I used these 4 register variables in my code. Is this helps to speed up my program?

Register keyword is used used to store a variable in CPU registers. Yes it speeds up the execution of your program


how many register variables that i can use? register key word all owes reserve a register for the program?

Number of register values depends on the number of registers in the CPU and also its availability (some of the CPU registers may be occupied for some task)

In case you declare more register variable than the total available registers then the rest of them will be considered as "auto" storage class
 

Re: Where should we use rigester keyword?

using 4 register variables in a program is detestable?

is gcc compiler is smart enough to optimize the code even i ignored the use of register keyword?
 

Re: Where should we use rigester keyword?

Keep the most frequently accessed variable in register
 

Re: Where should we use rigester keyword?

The register keyword is just a suggestion to the compiler to use a register for the variable it can't force it to happen.
The compiler may well ignore it as easily as it can use a register for any automatic variable if it thinks that it will benefit the speed.
I don't think there is a point to add the keyword , if it is needed it will be done anyway.

What is register variable in c language

Alex
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top