Click here to Skip to main content
15,897,315 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to terminate a process gently Pin
Jun Du26-Jun-06 16:43
Jun Du26-Jun-06 16:43 
GeneralRe: How to terminate a process gently Pin
Sam Hobbs26-Jun-06 17:14
Sam Hobbs26-Jun-06 17:14 
Question--------anti-copy problem Pin
dragooooon lee23-Jun-06 23:08
dragooooon lee23-Jun-06 23:08 
Questionhow we can get complilation time of our project Pin
happy_ram23-Jun-06 23:06
happy_ram23-Jun-06 23:06 
AnswerRe: how we can get complilation time of our project Pin
Naveen23-Jun-06 23:22
Naveen23-Jun-06 23:22 
GeneralRe: how we can get complilation time of our project [modified] Pin
ovidiucucu24-Jun-06 7:34
ovidiucucu24-Jun-06 7:34 
AnswerRe: how we can get complilation time of our project Pin
kakan25-Jun-06 19:34
professionalkakan25-Jun-06 19:34 
QuestionStack Overflow problem in Recursion ! [modified] Pin
Vinod Sankaranarayanan23-Jun-06 21:51
Vinod Sankaranarayanan23-Jun-06 21:51 
Sorry, Here is some more explanation !!!

I have a problem while recursively calls a function.

There is a class named "CCompletePath".

void CucDiagramManager::fun()
{
CCompletepath *pComPath=new CCompletePath();
int PathNum=1;
CreateFullPaths(pComPath,PathNum,false); // First call

delete pComPath;

}


bool CucDiagramManager::CreateFullPaths(CCompletePath* pComPath, int &num, bool bCheck)
{


bool rtn=false;

if(num>500000)
{
if(num==500001)
AfxMessageBox("Cannot create more than 500000 paths !");

num++;
return true;
}

PathIndex = pComPath->GetLastItemInPathArray();

if(PathIndex > -1)
{
CPartialPath *pPartialPath = (CPartialPath*) m_UCDPartialPathArray.GetAt(PathIndex);
// iterate through all the partial paths
for(int i=0;i<m_UCDPartialPathArray.GetSize();i++)
{

// get the 'i'th path as a temppath

CPartialPath *pTempPartialPath = (CPartialPath*) m_UCDPartialPathArray[i];



if((pPartialPath->GetNextElementID()) == pTempPartialPath->GetFirstElementID())
{
//Make a new copy
CCompletePath *pNewPath = new CCompletePath(*pComPath);
pNewPath->AddNextElementToArray(i);

//Setting the Complete Path String
if(pComPath->m_sPathString!="")
pNewPath->SetPathString(pComPath->m_sPathString);
if(pPartialPath->m_sPathString!="")
pNewPath->SetPathString(pPartialPath->m_sPathString);
//pNewPath->SetPathString(" " + pPartialPath->m_sPathString);

//Setting The Complete Path Priority
pNewPath->SetPathPriority(pPartialPath->m_dPathPriority);

if((pNewPath->m_dPathPriority < m_dPathLimitMinVal) || (pNewPath->m_dPathPriority << .000001) )
{
delete pNewPath;
return rtn;
}

if((pTempPartialPath->GetNextElementID() == -1))
{
m_CompletePathArray.Add(pNewPath); // add this path to array
i=m_UCDPartialPathArray.GetSize();
num++;

}
else
{
rtn = CreateFullPaths(pNewPath, num, bCheck); // recursive call
delete pNewPath;

}
}
}
}

Because the "pCompPath" object is very large ,I can't use normal object rather than pointer object.

The "CreateFullPaths" function is used to generate some paths.It may be 100,1000.....up to 5,00,000

The above for loop will run up to 1000 or 2000 times...
Because I want to generate more than 1,00,000 paths....



I cannot complete that loop....because "Stack Overflow !"


Help me to solve this ...
Thanks in advance ....



vinsankar

-- modified at 10:24 Saturday 24th June, 2006
AnswerRe: Stack Overflow problem in Recursion ! Pin
Sarath C23-Jun-06 23:05
Sarath C23-Jun-06 23:05 
AnswerRe: Stack Overflow problem in Recursion ! [modified] Pin
Stephen Hewitt24-Jun-06 2:04
Stephen Hewitt24-Jun-06 2:04 
GeneralRe: Stack Overflow problem in Recursion ! Pin
Vinod Sankaranarayanan24-Jun-06 4:25
Vinod Sankaranarayanan24-Jun-06 4:25 
GeneralRe: Stack Overflow problem in Recursion ! Pin
Stephen Hewitt24-Jun-06 17:45
Stephen Hewitt24-Jun-06 17:45 
Questionwebcam About webcam Pin
mt_samiei23-Jun-06 20:28
mt_samiei23-Jun-06 20:28 
AnswerRe: webcam About webcam Pin
Amar Sutar23-Jun-06 23:06
Amar Sutar23-Jun-06 23:06 
QuestionTab key Pin
kk.tvm23-Jun-06 20:22
kk.tvm23-Jun-06 20:22 
AnswerRe: Tab key Pin
Naveen23-Jun-06 20:32
Naveen23-Jun-06 20:32 
GeneralRe: Tab key Pin
kk.tvm23-Jun-06 22:41
kk.tvm23-Jun-06 22:41 
GeneralRe: Tab key Pin
Naveen23-Jun-06 22:45
Naveen23-Jun-06 22:45 
GeneralRe: Tab key Pin
kk.tvm24-Jun-06 0:46
kk.tvm24-Jun-06 0:46 
GeneralRe: Tab key Pin
happy_ram24-Jun-06 0:04
happy_ram24-Jun-06 0:04 
AnswerRe: Tab key Pin
Hamid_RT23-Jun-06 21:05
Hamid_RT23-Jun-06 21:05 
QuestionHow to bring EditBox in front of ListControl? Pin
arunashok23-Jun-06 19:41
arunashok23-Jun-06 19:41 
AnswerRe: How to bring EditBox in front of ListControl? Pin
Naveen23-Jun-06 20:03
Naveen23-Jun-06 20:03 
QuestionDocumentation Pin
MozhdehQeraati23-Jun-06 18:38
MozhdehQeraati23-Jun-06 18:38 
AnswerRe: Documentation Pin
Sarath C23-Jun-06 23:06
Sarath C23-Jun-06 23:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.