Author Topic: Some strange behaviors  (Read 22307 times)

Offline blueshake

  • Regular
  • ***
  • Posts: 458
Re: Some strange behaviors
« Reply #15 on: August 27, 2009, 08:23:04 am »
for me ,the two patch both work fine.
now , I need to find which one is much better.just need some time.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6035
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Some strange behaviors
« Reply #16 on: August 27, 2009, 08:54:22 am »
Code
wxString NativeParser::GetCCToken(wxString& line, ParserTokenType& tokenType)
{
    // line contains a string on the following form:
    // "    char* mychar = SomeNamespace::m_SomeVar.SomeMeth"
    // first we locate the first non-space char starting from the *end*:
    //
    // "    char* mychar = SomeNamespace::m_SomeVar.SomeMeth"
    //                     ^
    // then we remove everything before it.
    // after it, what we do here, is (by this example) return "SomeNamespace"
    // *and* modify line to become:
    // m_SomeVar.SomeMeth
    // so that if we 're called again with the (modified) line,
    // we 'll return "m_SomeVar" and modify line (again) to become:
    // SomeMeth
    // and so on and so forth until we return an empty string...
    // NOTE: if we find () args or [] arrays in our way, we skip them (done in GetNextCCToken)...

The last comment says: 

// NOTE: if we find () args or [] arrays in our way, we skip them (done in GetNextCCToken)...

So, it is better to change the function "GetNextCCToken" I think.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blueshake

  • Regular
  • ***
  • Posts: 458
Re: Some strange behaviors
« Reply #17 on: August 27, 2009, 09:57:21 am »
@ollydbg
would you agree to apply the second patch?
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6035
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Some strange behaviors
« Reply #18 on: August 27, 2009, 10:11:56 am »
@ollydbg
would you agree to apply the second patch?

Yes, I personally prefer the second patch just do the Trim() function.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.