(05-23-2014 08:37 PM)Claudio L. Wrote: Besides your specific case, in general, scoped local variables have been in most programming languages since I was a kid.
99.9% of the compilers use a stack to store your local variables (ok, they use microprocessor registers when they are available, then fall back to the stack when they run out). That's how they avoid 'all these problems', so the 'problems' aren't really there for the user, they are solved by the compiler/interpreter at a lower layer.
So the stack is always there, you like it or not, and it takes about the same amount of RAM and processing power whether you are the one driving it or a compiler/interpreter. It really goes to what the user wants/needs:
Direct access to the stack? or use readable names and let a compiler/interpreter handle the stack for you?
A lot of people prefer engines with carburators because they can understand how it works, they love to open the hood, take it apart and fiddle with it all they want. Some other people prefer modern injection engines, where you have to plug a laptop to fiddle with it and you never actually get dirty, and there's others that don't even know that there's an engine in the car and don't really care as long as the car moves.
For calculations it's exactly the same: There's people that want to see and control every step of their analysis. There's people that want their analysis done for them but like to see automatic step-by-step solutions, and then there's people that just want the final answer and don't care how you get there.
There's a place for everything, for high level languages with variables, for lower level languages with stacks, and even for senseless flame wars of RPN vs algebraic.
Claudio
PS: I wrote a firmware for a PIC16F for my Masters thesis. A pain to code in assembler but lots of fun. In that microcontroller, you'll have a hard time guaranteed, RPN or algebraic. For those interested:
http://www.microchip.com/wwwproducts/Dev...=PIC16F876
And yes, it is BYTES of ram, there's no K, no M, no G before bytes.
Hi Claudio,
Today I real learned something. Thank you very much. Very well explained and very informativ.
Now I understand where to "place" the need of the "Stack".
I am a "End-User" and I need a computer to help me to work and not prevent me from work.
Yes, I do not care how the Hardware/Software do "its" job to help me. It is a matter of fact, indeed.
Now, about flaming, I have the feeling that there are people that "interpret" any "against" opinion as some sort of provocation. Well, I can very well deal with "against" opinios while I mainting my serenty and clearity about the main problem.
Regards
Alvaro