Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/26/02 18:44
Read: times


 
#33211 - RE: C++ style in C. mahmood
"I believe the chip uses registers for passing parameters"

The chip doesn't know anything at all about passing parameters!
This is entirely a matter of the Compiler implementation.

"puts them on the stack"

No.
The miniscule Stack on the 8051 is entirely unsuitable for 'C' parameter passing! Therefore 'C' compilers targetted at the 8051 use registers where possible, and then fixed memory locations

"If you've got a large program and limited space, as in the project I am working on now, you run the risk of stack overflow with parameter passing and are therefore stuck with globals."

Not at all!
'C' compilers targetted at the 8051 use registers & fixed memory locations for locals & parameters, and a technique known as Overlaying to re-use those locations wherever possible.
This is why function pointers are such a problem for such compilers!

Try a search for "function pointers" on the Keil forum for a detailed discussion!

This is why, as I mentioned earlier, the use of local variables can actually reduce your memory requirements!

List of 24 messages in thread
TopicAuthorDate
C++ style in C            01/01/70 00:00      
RE: C++ style in C            01/01/70 00:00      
RE: C++ style in C            01/01/70 00:00      
RE: C++ style in C            01/01/70 00:00      
RE: C++ style in C            01/01/70 00:00      
RE: C++ style in C            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      
RE: C++ style in C/ Erik            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      
RE: C++ style in C/ Erik            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      
RE: C++ style in C. //Judy / Erik            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      
RE: C++ style in C. Erik            01/01/70 00:00      
RE: local global???!!!?!?!?!            01/01/70 00:00      
RE: local global???!!!?!?!?!            01/01/70 00:00      
RE: local global???!!!?!?!?!            01/01/70 00:00      
RE: C++ style in C            01/01/70 00:00      
RE: C++ style in C. mahmood            01/01/70 00:00      

Back to Subject List