stack

Question about "push" and the stack

If you push something into the stack multiple times (in a loop for example), does the stack keep growing or is the previous value replaced? For example, repeating push EDI 5 times. Would the stack have 5 EDIs? ...

Eclipse: stack or pile for cut & copy & paste?

hi there im just wondering as I couldn't find an answer on google (well, maybe Ive been trying the wrong keywords here >.< )... A thing I've always dreamt about was a stack/pile cut feature which remembers the - uhm, lets say - 10 last things I've cut out or copied for pasting... Is there such a feature and if so, what is it called? fur...

Is there a maximum limit to the size of a variable that should be allocated on a stack?

i declared a struct variable in C of size greater than 1024bytes. On running Coverity (a static code analyzer application) it reports that this stack variable is greater than 1024 bytes and therefore a cause of error. I'd like to know if I need to worry about this warning? Is there really a maximum limit to the size of a single stack var...

Single linked list in Python, how to write pop and push.

I am trying to code a class that makes use of Push and Pop from a stack (with single linked list). I am not sure how to write the push and pop functions. Please help me, I really need a simple example written in Python with the following functions. Push Pop ifEmpty ...

event question in Flex / FlashBuilder 4 beta2

I see that others are reporting bugs relating to a spurious "Stack depth is unbalanced" error, so I don't know whether the error I'm getting is my programming error or a bug in FB4 b2. It it legal to instantiate a class that raises an event in an eventHandler? I'm getting such an error at the place located below. All of these classes ex...

In C++, is it possible to reconcile stack-based memory management and polymorphism?

I love declaring variables on the stack, especially when using the standard container. Each time you avoir a new, you avoid a potential memory leak. I also like using polymorphism, ie class hierarchies with virtual functions. However, it seems these features are a bit incompatible: you can't do: std::vector<BaseType> vec; vec.push_back...

Input asked for better programming practices

As I'm learning C++ I started implementing some common datastructures as a form of practice. The first one being a Stack (this was the first to spring in mind). I've done some programming and it's working, but now I need some input as to what I should do otherwise. Like deleting certain stuff or other pro tips. What should I do different...

Unable to locate the Bug

I was recently on The Daily WTF when I came across this old post. In it the author mentions that one of the programmers changed this code: int main (int argc, char **argv) { int x; char data_string[15]; ... x = 2; strcpy(data_string,"data data data"); ... } To this code: int main (int argc, char **argv) { int x = 2;...

Explanation of how stacks work in C

I am just wanting a simple explanation of the linking process when pushing data onto a stack. I know how to build on using the code from my book, but I am not really sure I understand how the process works when you move the stack head link from one to the next. For stacks like: typedef struct node { void dataptr; struct node* l...

Can the stack size be changed dynamically - How?

Can the stack size be changed dynamically in C? If yes, How? ...

erlang call stack

i need to debug some module in foreign system, module has public function foo() - how can I know place (module and function name) from which foo() given module was called? I mean stack of calls. PS: I cannot stop system, all work I can do by reload this module (but with som debug info) -module(given). -export(foo/0). foo() -> %% he...

How can I preserve or identify a caller's stack frame?

My brain feels slow today. I'm writing pre/post/invariants in Python using decorators. Currently, I need each call to specify the locals and globals for context, and this feels ugly. Is there a way to get the locals and globals from the decorator application level even though it's an arbitrary depth. That is, I'm trying to make ...

Unexpected operation order in Stack<T> related one liner

Hi all By calling Push() and Pop() an instance of Stack<T> in a single line I get a different behavior than performing the imho same code in two lines. The following code snippet reproduces the behavior: static void Main(string[] args) { Stack<Element> stack = new Stack<Element>(); Element e1 = new Element { Value = "one" }; Elemen...

Java: Would decreasing the stack size speed up frequent method invocations?

Hello, everyone! Everywhere I keep reading about increasing the JVM stack size (i.e. to allow deeper recursions). But I'm asking myself, would decreasing of the stack size speed up method invocation? Probably my understanding is wrong, but I assume, that the allocation speed of each stack (not only for recursive method calls) depends ...

Increase stack size in Linux with setrlimit

Hi, reading information about how to increase stack size for a c++ application compiled with gnu, at compilation time, I understood that it can be done with setrlimit at the beginning of the program. Nevertheless I could not find any successful example on how to use it and in which part of the program apply it in order to get a 64M stac...

How can we convert Prefix to Postfix expression ( without using expression tree)?

By using Stack data structure, we can easily convert "Infix to Postfix" and "infix to Prefix" but I can't convert Prefix to postfix. yes, we can convert prefix to infix then infix to postfix. but I want direct conversion from prefix to postfix. Is there any feasible solution (not expression tree) ? ...

When object is contructed statically inside a function, would it be allocated on the heap or on the stack?

if i have the following code: for (...) { A a; } would a be allocated on the heap or on the stack? ...

MIPS function inside a function

I am trying to have the function vbsme call another function called sad... is the following procedure correct about saving the registers and return address?? the caller is supposed to save register $t0-$t7, but where and how should I do that? vbsme: li $v0, 0 # reset $v0 li $v1, 0 # reset $v1 li $t0, 1 # i(row) = 1 ...

Assembler Stack Alignment (or better misaligned example with PUSH)

Hello!, Well first I understand (or a I think that I understand) the problems of misaligned stack. But I know (like a definition) that pushing a 16bit value to 32bit wide stack could cause a stack misaligned. But the thing I dont understand, is how this could happend...since PUSH and POP check the D flag at the segment descriptor (so ...

Assembly - Trying to reverse string, but it adds an extra character on the final string.

Hi folks. I'm rather new to Assembly (And programming in general, to be honest). I'm trying to play with the stack. The purpose of this code: Take in a String, limited to 80 characters Reprint the String as entered Print each character as it is pushed to the stack Print each character as it is popped from the stack Print the reversed S...