The stack tag has no wiki summary.
1
vote
2answers
76 views
Application of Implementing 3 Stacks in single array [Need]
Well there is lot of discussion about implementing 3 [ or 2 stacks ] in a single array. [Interview question] but whats the real need or application for implementing stacks like that?
can't we allot ...
2
votes
1answer
111 views
How does a program's virtual address space get translated to physical address space on the stack?
For example, I launched a self-made SDL program that I compiled and linked as a Windows PE on Win 7 64-bit. I checked the Assembly output, both the linked libraries and source from the file, and read ...
0
votes
6answers
690 views
Heap overflow vs stack overflow
So as a general rule to avoid a stack overflow, big objects should be allocated to the heap (correct me if I am wrong). But, since the heap and the stack expand towards each other, wouldn't this cause ...
3
votes
3answers
379 views
Understanding stack frame of function call in C/C++?
I am trying to understand how stack frames are built and which variables (params) are pushed to stack in what order? Some search results showed that the C/C++ compiler decides based on operations ...
0
votes
1answer
189 views
Frame Pointer Explanation
In MIPS assembly, there is a register for the stack pointer, and another register for the frame pointer. What is the frame ponter and what is its purpose. How does it differ from the stack pointer?
5
votes
3answers
733 views
A good C Variable Length Array example
This question got rather a freezing reception at SO, so I decided to delete it there and try here instead. If you think it does not fit here either, please at least leave a comment on suggestion how ...
6
votes
1answer
264 views
Why is the main memory for object allocation called the 'heap'?
Has anybody got an idea why the area of main memory where objects are allocated is referred to as the heap. I can understand the rationale for that of the stack LIFO but would like to know what the ...
4
votes
4answers
527 views
Stack and heap - dynamic allocation question
Sources usually mention that dynamically created variables are allocated on the heap, while functions' variables on the stack. Also the ones on the stack cease to exist automatically when e.g. the ...
4
votes
4answers
303 views
Is there a way to display the stack during recursion method?
I'm trying to learn recursion. I copied this bit of code from my book and added the displays to help me trace what the method is doing and when.
public static void main(String[] args) {
...
2
votes
3answers
446 views
Confusion of the “stack” in Assembly-level programming
What is the "stack" exactly? I've read articles, tried comprehending it through my understanding, experience, and educated guessing of programming and computers, but I'm a bit perplexed here.
The ...
2
votes
2answers
307 views
Which are the fundamental stack manipulation operations?
I'm creating a stack oriented virtual machine, and so I started learning Forth for a general understanding about how it would work. Then I shortlisted the essential stack manipulation operations I ...
3
votes
2answers
677 views
Amortized Analysis? (Worst-case Performance Guarantees)
What is Amortized Analysis? And how can it help me achieve worst-case performance guarantees in my programs?
I was reading that the following techniques can help the programmer achieve Worst-case ...
7
votes
1answer
468 views
Conceptually what does it mean when it is said that each thread gets its own stack?
I have been reading Java Concurrency in Practice by Brian Goetz and inside the section Stack Confinement it is mentioned that each thread gets its own stack and so local variables are intrinsically ...
0
votes
1answer
115 views
Tool to visualize values from variables during the execution of a program in C
I just need to see what is stored, in realtime, in some particular variables and struct used by an application written in C.
I need something like the stack tracer that comes with the ADT plugins for ...
22
votes
4answers
2k views
Why is putting something on the stack called “push”?
According to http://dictionary.reference.com
push
verb (used with object)
to press upon or against (a thing) with force in order to move it away.
to move (something) in a specified ...
5
votes
3answers
251 views
Dynamic typing across the whole technology stack - where to enforce data validity?
Over the past year or two, I've been playing with newer technologies in my side projects. As a web developer, I've gone from the following (and still the following, at work):
The 'classic' technology ...
5
votes
8answers
4k views
What is the difference between an Array and a Stack?
According to Wikipedia, a stack:
is a last in, first out (LIFO) abstract data type and linear data structure.
While an array:
is a data structure consisting of a collection of elements ...
1
vote
3answers
502 views
Call stack starts at bottom or top?
A stack is something that piles bottom-up.
Hence a call stack adds new items on the stack when functions are called with items being removed from the stack as each function ends until the stack is ...
16
votes
3answers
1k views
Why does the stack grow downward?
I'm assuming there's a history to it, but why does the stack grow downward?
It seems to me like buffer overflows would be a lot harder to exploit if the stack grew upward...
3
votes
5answers
621 views
Stack instructions machines
When I look up "stack machine" I often get stuff like the JVM that uses stack for data, but still uses an array to store its instructions.
I would like to find out more about machines whose programs ...
1
vote
1answer
387 views
In c/c++, are block-scope variables stacked only if the block is executed?
Suppose this:
void func()
{
...
if( blah )
{
int x;
}
...
}
Is the space for x reserved on the stack immediately when func is entered, or only if the block is actually executed?
Or is it ...
5
votes
3answers
808 views
Local Stack vs Call Stack
On the matter of Recursion:
When you create a recursive function, you create a call stack. Ok, no problem; However, a comment on this page (look for comments by "LKM") triggered my curiosity (and ...
10
votes
6answers
2k views
Why do we need a Heap if everything can be done much more efficiently on the Stack?
This is actually somewhat related to the question I asked yesterday about why both a Stack and a Heap are necessary in the applications we use today (and why we can't just go with a Heap instead of ...