"Ilia Poliakov" <ip*****@allesklar.de> wrote in message
news:bf************@ID-120622.news.uni-berlin.de...
I have a static function in the class like this:
class A
{
static void f1()
}
void A::f1()
{
.....
}
In f1() I declare a number of local variables and once I become the
error message:
Run-Time Check Failure #2 - Stack around the variable '$S28' was
corrupted.
Is there a stack limit for such case? Or what should I do?
Though stacks have their limits, it is not too likely that that is the
problem in your case. Most likely it is a bug in your code. But it is
difficult to tell what exactly the problem is, since you did not post
minimal yet complete code that demonstrates the problem.
To give you a clue the following code would lead to stack corruption on
many systems:
void A::f1()
{
int a[10];
for(int i=0; i < 20; ++i)
{
a[i] = 123456;
}
}
What will happen here depends on compiler, compiler settings and
platform. But typically when i > 9 this loop will start to overwrite the
return address,and possibly the 'this' pointer and other function
arguments, local variables of the calling function and who knows what
else...
--
Peter van Merkerk
peter.van.merkerk(at)dse.nl