I have the following function
void DoSomething(int start[10], int end[10])
When I call it via
void Do(void)
{
int start[10] = {1,2,3,4,5,6,7,8,9,0};
int end[10] = {1,2,3,4,5,6,7,8,9,0};
DoSomething(start,end);
}
do I put two pointers (8 byte all together) or two arrays each of 40 bytes in size on the stack?
...
This feels a lot like finding a needle in a hay stack but here goes.
I'm building a Windows Mobile 6.1 application. Specifically I'm trying to port over the OpenCV framework. Having successfully (doubtfully) compiled OpenCV for the ARM4I architecture, I'm trying it out in a simple hello world style application.
From my WinCE .EXE I'm c...
From:
http://en.wikipedia.org/wiki/X86%5Fcalling%5Fconventions
push c
push b
push a
call function_name
add esp, 12 ;Stack clearing
mov x, eax
Why do we need to explicitly add 12 to ESP to clear the stack since the called function should have poped the parameters off the stack therefore restoring the stack pointer...?
Another questio...
Possible Duplicate:
When is it best to use a Stack instead of a Heap and vice versa?
I've read a few of the other questions regarding the heap vs stack, but they seem to focus more on what the heap/stack do rather than why you would use them.
It seems to me that stack allocation would almost always be preferred since it is quic...
Hi i just started learning C++ couple of weeks ago. So now I have this school assignment problem that asks me to implement a linked-list without using "new" or anything to do with dynamically allocating memory (and cannot use any ADT from STL). The prof says that everything can be done on the stack, but how? I have been working on this s...
Hi all,
In your actual programming experience, how did this knowledge of STACK and HEAP actually rescue you in real life? Any story from the trenches? Or is this concept good for filling up programming books and good for theory?
...
Help!
I have 2 variables from different datasets. Each variable has a different name in each dataset. However, the variables are delivering the same type of information for a single resspondent.
Ex.
Variables 1 & 2 for respondent #1
DR1IFDCD
11111000
32104950
51101010
81103080
11111000
DR1IFDCD
92410310
92101000
12210250
31105000
2...
I have a base class, Token. It has no implementation and as such acts as a marker interface. This is the type that will be used by callers.
{
Token t = startJob(jobId);
// ... (tasks)
// t falls out of scope, destructors are called
}
I have a derived class, LockToken. It wraps around a mutex and insures the lock is acquire...
Are there any cases when I would want to use an explicit stack data-structure in my algorithms, as opposed to doing recursion (which uses the call stack)?
Is there any benefit to doing it one way over the other? I would think using the explicit data-structure would be more performant because it doesn't require the method calls but then...
I have the following defined:
Stack<ASTNode*>* data;
The way the class is defined, if I do data->push() or data->pop(), I directly push onto the stack or pop off the stack. To get the node at the top of the stack I would do data->peek(). For testing purposes, I would like to print out the top node in the stack like this:
cout << "top...
Without using recursion how can a stack overflow exception be thrown?
...
I'm struggling getting the pseudo code for this.
Scan string left to right for each char
If operand add it to string
Else if operator add to stack
....
i'm struggling on how to handle ( )s
...
On rare occasions when my program exits, I get a "value of ESP has not been saved across a function call" error. The error is quite random and hard to reproduce.
How do I debug this error (VC++ 2008)? How harsh it is, as it only occurs on shutdown? Is the error visible also in release mode?
...
What is the best way to implement a Stack and a Queue in JavaScript?
I'm looking to do the shunting-yard algorithm and I'm going to need these data-structures.
...
I have to do this for a basic C++ lecture at my university, so just to be clear: i would have used the STL if i was allowed to.
The Problem: I have a class named "shape3d" from which i derived the classes "cube" and "sphere". Now i have to implement "shape3d_stack", which is meant be able of holding objects of the types "cube" and "sphe...
Consider the following code:
class myarray
{
int i;
public:
myarray(int a) : i(a){ }
}
How can you create an array of objects of myarray on stack and how can you create an array of objects on heap???
...
Hello,
I realize that this may sound like a silly question, but the last time I programmed it was in assembler so my thinking may be off:
A recursive function as so:
def fac(n):
if n == 0:
return 1
else:
return n * fac(n - 1)
Why is it that when the function reaches n == 0 that it does not return 1 but rather...
Hi!
I have some vectors of class A objects:
std::vector<A> *V1;
std::vector<A> *V2;
etc
there is a function with a vector of pointers of A:
std::vector<A *> *arranged;
what I need to do is put the vectors from V1, V2 etc inside arranged without destroying them in the end, so I thought that a vector of pointers to those objects...
For this method, I have to make a shallow copy of a linked list stack.
So, first I would initialize the linked stack then would I use a for loop to go through the values to copy the stack. But, to put them in the right order, would I just have a nested loop to reverse the group of values?
here is what I got so far, am I missing somethi...
Scenario:
I have 50 (or more) processes running (myproc.exe) that do some business logic.
I want to have a web server that takes simple GET's (/foo.html) and just pass this information (the location of GET) one of the running myproc.exe
myproc.exe's and this exe (the webserver) have named pipes between them (so 50 named pipes) that pas...