memory - Concept of register variables(datatype:register) in C language? -
memory - Concept of register variables(datatype:register) in C language? -
i want thought how register variables handled in c programme executables. ie in location(or register) stored in case of embedded scheme , in x86 machine(c programme executable in desktop pc)?
what view? (correct me if wrong)
suppose have declared/initialized 1 variable within function 'int' datatype. go stack segment , there in section @ run time ,when caller calls callee containing local variable. if declare above local variable 'register int' it'll go stack segment. on run time , processor set local variable stack general purpose register locations(because of compiler inserted code due 'register' keyword) , fast access of same there.
that difference between them @ run time access , there no memory loading differences between them.
__kanu
the register
keyword in c (rarely ever seen anymore) hint compiler may useful maintain variable in register faster access.
the compiler free ignore hint, , optimize sees best.
since modern compilers much improve humans @ understanding usage , speed, register
keyword ignored modern compilers, , in cases, may slow downwards execution speed.
c memory
Comments
Post a Comment