Eric, did you ever program the Microchip PIC series?
They used to have (don't know about the current ones) a hardware stack.
All local variables had to go to a fixed memory location too, recursions were 
forbidden.
(actually local variables were handled like static ones but initialized on 
function start)
Still the programming language was C. (not really ++)
Well, the PICs were no real processors but rather programmable interrupt 
controllers
(hence the name). And I'm really happy we moved from PIC to MSP before I 
entered teh scene. I had to do maintenance on some of the PIC projects
(and to migrate some to MSP) and I'm happy I hadn't to deal with a pIC
for years now.

But it shows that there is no generic answer to where variables live.
It really (as you said) depends on the processor and the compiler.

JMGross

----- Ursprüngliche Nachricht -----
Von: Eric Decker
An: Sergio Campamá
Gesendet am: 30 Sep 2011 02:11:40

next up is the stack.   This depends on the architecture of the underlying
machine but some sort of stack is usually implemented and the compiler knows
how take advantage of these things.   The compiler uses the stack for saving
registers on entry to a routine and restore on exit.  It also uses the stack
for allocating space for local variables.   A stack typically is a LIFO
(last in first out) queuing structure.

But where does the stack live...  When a program first boots up (assuming an
embedded system), one of the things that happens is the stack pointer is
set.  A region of memory is set aside for the stack and the stack pointer is
set to the top of the stack area and grows downwards as things are pushed on
to the stack.  All of these of course depends on how the stack and the cpu
is implemented.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to