Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ollydbg on March 03, 2009, 03:34:16 pm

Title: question on the GetDeepestMatchingPosition function
Post by: ollydbg on March 03, 2009, 03:34:16 pm
This is a bit strange.

Code
inline unsigned int SearchTreeNode::GetDeepestMatchingPosition(BasicSearchTree* tree, const wxString& s,unsigned int StringStartDepth)

I carefully examined the code, I found that the above function will always be called with the parameter StringStartDepth==0.

The only existence of this call is in FindNode().

Code
bool BasicSearchTree::FindNode(const wxString& s, nSearchTreeNode nparent, SearchTreePoint* result)
{
        size_t top_depth = m_pNodes[nparent]->GetDepth();
       ......
        unsigned int newdepth = childnode->GetDeepestMatchingPosition(this,s,top_depth);
       ......
}

But all the FindNode() function was used like below( the second parameter is always 0 )

Code
FindNode(s, 0, &resultpos)

So, the root node's parent is itself. and its depth is surely zero.


Any comments?  Thanks.