| SledgeHammer 2005-06-09, 4:02 pm |
| Hello,
it seems to me that the visaul c++ compiler (vs.net 2003) has a bug compiling
try/catch in while loops. The following code crashes in a stack overflow
when you compile it with /clr. Does anybody have a comment on this?
Best reagards
Detlev
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
bool g_b=false;
//introducing the unmanaged prgama seems to solve the problem too
//#pragma unmanaged
void CrashTest()
{
//introducing AND initializing
//a local variable seems to solve the stack overflow
//without this local variable the function causes a stack overflow
//int i=0;
while(true) {
bool b(false);
try {
b=true;
}
catch(...)
{
}
g_b=b;
}
}
//#pragma managed
int _tmain()
{
Console::WriteLine(S"Hello World");
CrashTest();
return 0;
}
|