Hi guys) Please tell me - why is it impossible to keep global variables in C in a processor register?
thanks in advance)
vedro-compota 33 Posting Whiz
Recommended Answers
Jump to PostThe reason is that there are only a limited finite number of resigers available to the program. For example on Intel and compatible processors there are only 6 register variables in common use throught the program (eax,ebx,ecx,edx,esi and edi), so it would be impossible to store global variables in them.
Jump to PostA value is a value, and any appropriate value can be place in a register, but if the global variable's value changes and something reliant on it is only being given the value from the register; then the value in the global is no longer the same as the one …
All 7 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
vedro-compota commented: +++++++++ +1
vedro-compota 33 Posting Whiz
MosaicFuneral 812 Nearly a Posting Virtuoso
vedro-compota commented: +++++ +1
vedro-compota 33 Posting Whiz
MosaicFuneral 812 Nearly a Posting Virtuoso
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
vedro-compota 33 Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.