Ok from searching on the net it appears to me that there is no standard library for dealing with a stack. Is this correct?
Printable View
Ok from searching on the net it appears to me that there is no standard library for dealing with a stack. Is this correct?
did search of include directory
no, not for c
The reason is, there are many ways to implement a stack. A stack is really just a concept of how a process works. You could implement it using an array, which you'll see commonly used in books when they introduce you to stacks. You could implement it using a linked list. Push a node onto the stack, pop it off. The point is, there are numerous ways to implement the concept. That's probably why there is no "standard" way of dealing with stacks and queues.
Qzuah.
Thanks you two.
Another question, what about using the process' stack directly ala ASM push and pop without doing inline asm. Is that a possibility?
I don't know that you'd want to. The stack space is where all your function calls and such are being piled. You probably wouldn't want to tinker with that, since the program itself is going to be using it. You wouldn't want some function call overwriting the stack space you're trying to use, or vice versa.
I assume you'd be trying to manipulate this for speed reasons or some such? Otherwise, I don't see the point of trying to use the stack space of the process itself manually.
Quzah.
Actually I'm thinking of doing it for "overwelming my C teacher with crazyness" effect.
Ultimate goal is to have only one variable for the entire program which is a pointer to a memory location, with all functions called by deferencing function pointers, and doing my own parameter passing.
Yes I'm bored :)
(ASM class is making me eviler)