stack

how does an optimizing c++ compiler reuse stack slots of a function?

How does an optimizing c++ compiler determine when a stack slot of a function(part of stack frame of a function) is no longer needed by that function, so it can reuse its memory? . By stack slot I mean a part of stack frame of a function, not necessarily a whole stack frame of a function and an example to clarify the matter is, suppose w...

Stack, Frame, Global Pointer and ELF files

How do I determine where the stack, global, and frame pointers are in my ELF file? ...

C++: speed of std::stack::pop() method

I'm writing a lighter version of some containers from STL for myself. (I know that STL was written by professional programmers and I am too stupid or too ambitious if think that I can write it better than they did. When I wrote my list (only with method I need), it worked few times faster. So, I thought it's a good idea. But, anyway.) ...

Why does avr-gcc bother to save the register state when calling main()?

The main() function in an avr-gcc program saves the register state on the stack, but when the runtime calls it I understand on a microcontroller there isn't anything to return to. Is this a waste of RAM? How can this state saving be prevented? ...

c++ return reference / stack memory

A basic question that I'm not sure of the answer. Is the follow function valid? std::vector<int> & test_function() { std::vector<int> x; // do whatever return x; } If so, why? Shouldn't the program delete x from the stack after the function returns? Thanks. ...

Navigating Java call stack in Eclipse

In debuggers like gdb, when you are stopped at a breakpoint, you can easily move up the call stack and examine the relevant source and stack frame data. How do you do this in Eclipse? ...

Is it possible to create stack class that take any type of variable? not only 1 type...

I have seen stack class that uses the template to define the type of data the stack hold. What if I want a stack that hold different type of data? I have a little thought into it and come close to using void pointer (but void pointer can't be dereferenced, so it is not the correct solution) So... Is it possible to have such a class? ...

Executable Initialization

When is it decided where the stack, global, and frame pointers are in memory? I'm trying to load an ELF executable into a simulator and I can't figure out what instructions load the global, stack and frame pointers into the regfile. ...

Difference between Static Corruption and Stack Corruption

Can anyone explain insights about the difference between Stack corruption and Static corruption ? ...

Java bluetooth library compatible with Toshiba stack?

Hi Does anyone knows any java bluetooth library that is compatible for Toshiba stack? I'm trying to write bluetooth server that is supposed to run on my Toshiba Satelite laptop and I tried to use bluecove library but it is not compatible with Toshiba stack:( Thanks! ...

dictionary and stack in python problem

I have made a dictionary and I put the keys of the dict in a list. My list contains elements like this: s = [((5, 4), 'South', 1), ((4, 5), 'West', 1)] I made a dict from this: child = dict((t[0], t[1]) for t in s) keys = child.keys() print keys The output is : [(4, 5), (5, 4)] Now I need to put (4,5) and (5,4) into stack. What ...

stack problem in python

Possible Duplicate: dictionary and stack in python problem s = [((5, 4), 'South', 1), ((4, 5), 'West', 1)] I want to put the (5,4) and (4,5) in to the stack. stack is already implemented in a file... so I am using : stack = search.Stack() Now I can use push and pop for stack. How to get the (5,4) and (4,5) from the list...

Jquery Draggable and Stack and sec. CLass?

Hi all, I have a little problem with the Jqueri UI Stack $('.dra').draggable({ addClasses: false, containment: 'window', zIndex: '9999', stack: '.sta'}); The problem is that all DIVs with the class .dra are with stack. But i only want all div with the class .dra and with the second class .sta with stack. or must i say $('.dra .sta'...

Stack overflow exception in c# setter

Hi. This is simple to explain: this works using System; using ConstraintSet = System.Collections.Generic.Dictionary<System.String, double>; namespace ConsoleApplication2 { class test { public ConstraintSet a { get; set; } public test() { a = new ConstraintSet(); } static void ...

Java memory allocation on stack vs heap

I feel like a novice for asking this question -- but why is it that when I pass the Set below into my method and point it to a new HashSet, it still comes out as the EmptySet? Is it because local variables are allocated on the stack, and so my new is blown away when I exit the method? How could I achieve the functional equivalent? imp...

Does Stack<> constructor reverse the stack when being initialized from other one?

Here is the code: var s = new Stack<int>(); s.Push(1); s.Push(2); s.Push(3); s.Push(4); var ns = new Stack<int>(s); var nss = new Stack<int>(new Stack<int>(s)); and then let's see the result tbLog.Text += "s stack:"; while(s.Count > 0) { tbLog.Text += s.Pop() + ","; } tbLog.Text +=...

Saving stack by directly writing into the send buffer below

Imaging having a stack of protocols and some c/cpp code that neatly covers sending on each layer. Each send function uses the layer below to add another header until the whole message is eventually placed into a continuous global buffer on layer 0: void SendLayer2(void * payload, unsigned int payload_length) { Layer2Header header; ...

Freezing Network Stack

I want to send out page requests from a browser window as fast as possible to test website responsiveness but don't have any idea how to do it. On the receiving end is a server that will be getting multiple packets but in order to insure that they are being processed in an FIFO manner I want to send them as close to one another as possi...

Retain only one copy of an activity on the stack when called from non-activity

How can I make sure I only retain one copy of an activity on the stack when called from non-activity? When called from an activity I can just add the FLAG_ACTIVITY_REORDER_TO_FRONT flag to the Intent, but how can I do this from e.g. a widget or a notification? ...

Can I exhaust stack?

I know that by using operator new() I can exhaust memory and I know how to protect myself against such a case, but can I exhaust memory by creating objects on stack? And if yes, how can I check if object creation was succesful? Thank you. ...