For Programmers: Free Programming Magazines  


Home > Archive > VC Language > June 2005 > Compiler Bug in While loop?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Compiler Bug in While loop?
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;
}



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com