|
I could not find any problems with the loop.
If possible, replace your code with a while loop that will be easy to modify and debug.
In which point, the error occurs?
Are you trying to get any big amount of data to stack for temporary storage? (or reasonalbly big one cause alot of stack usage if it runs multiple times).
Try with incrementing stack size by changing project seetings.
SaRath.
"Do Next Thing..."
Understanding State Pattern in C++
|
|
|
|
|
First off something which is not related to your problem but is not ideal:
void fun()
{
CCompletepath *pComPath = new CCompletePath();
CreateFullPaths(pComPath);
delete pComPath;
}
Why are you using the heap for CCompletePath when its lifetime is confined to the fun function? You should do it like this:
void fun()
{
CCompletepath cp;
CreateFullPaths(&cp);
}
This is faster, safer as you can't forget to delete it and it doesn't contribute to heap fragmentation. The only reason to prefer using the heap in this case would be if the object is very large.
As for your problem it's hard so say as your code isn't clear as presented here. For example, the function CucDiagramManager::CreateFullPaths takes three parameters but you call it in fun (which I assume is meant to be a member function of CucDiagramManager but this isn't clear from the code) with only one. Also there is no formatting. Also we can't read any "<" or ">" symbols in the code or the text which comes after them as they are being interpreted as HTML. Here's some tips: take some care that people understand your problem; try ticking the "Ignore HTML tags in this message (good for code snippets)" check box; proof read your post to make sure it makes sense.
Steve
|
|
|
|
|
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
vinsankar
|
|
|
|
|
I sorry, but without formatting (tabs) this code is simply too hard to read. I don't mind helping if I can but you have to meet me half way and make the code readable.
Steve
|
|
|
|
|
Hi guys
In one project I need to capture the frames of webcam
independent of webcam company.
May you please give me information about it .
Regards
Mahdi
|
|
|
|
|
|
Hi
How to switch focus on controls using Tab key in a FrameWnd. The controls are created using CreateWindow function.
Thanx in advance
KK
KK
|
|
|
|
|
while creating the controls specify the style WS_TABSTOP
nave
|
|
|
|
|
Hi
How to specify order of controls
thanks
KK
|
|
|
|
|
the order in which the tab will move will be in the order in which u create the controls...
nave
|
|
|
|
|
|
1)Choose layout/tabOrder from the menu.you see numbers beside each contol.
2)by using mouse u can change the order
sree.
|
|
|
|
|
You can use WS_TABSTOP in Create or use in ModifyStyle
whitesky
|
|
|
|
|
Dear all,
I have created a list control with color changes taking place using "OnCustomdrawMyList".
Later, I wanted to edit the subitems in the listcontrol.I proceeded referring an excellent article titled "Editing Sub-Items in List Control"
by S.PrabhakarReddy.Till then everything was fine.
When I tried to edit the values, I could not see the change taking place in the ListControl while entering values.But change is made & could be seen on pressing Enter.As you guessed right, the user feels discomfortable if he cannot see the values while editing them.
It works fine, but while entering the values I cannot see them since the editbox is lying beneath the listcontrol.I am an amateur in this field.Please explain the steps, I may follow.
Could anyone help me and convert my to
Thank You.
|
|
|
|
|
Create the edit control as the child of the List control...
nave
|
|
|
|
|
I want to use NDoc with Visual C++.NET.I have written the XML tags, but I don't know how can I make the XML file?
Thanks in advance.
|
|
|
|
|
|
I know how to write XML tags in my source code.I have to go to the "configuration properties" of my project property and then go to "C/C++" node, I have to select "Output File" and then change the "Generate XML File " to yes. But this option doesn't exist in the "Output File"? Does Visual C++.NET 2003 support it or not?
Thanks.
|
|
|
|
|
I think NDoc supports only C# and VB .NET. Unfortunately, C++ is not well served by .NET tools.
Kevin
|
|
|
|
|
Visual Studio.NET 2005 supports this ability, but I couldn't find it in Visual Studio.NET 2003. I want to know whether it is possible to make an XML file out of the XML tags in the code or not. It is very important to me to use Visual Studio.NET 2005.Please help me. Thanks.
|
|
|
|
|
I've no idea. I've not used C++ in any of the .NET IDEs. Any C++ I do commercially is always in VC++ 6, and I haven't done any commercial C++ for over a year now.
Kevin
|
|
|
|
|
What is the principle motivation for having .h and .ccp files in visual C++?
Thanks, Moujan
|
|
|
|
|
Seperate the interface from the implementation.
John
|
|
|
|
|
|
Just an aside note: that's not a Visual C++ issue, but a C++ one in general.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|