Author Topic: cc code refine  (Read 6563 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5721
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
cc code refine
« on: May 29, 2011, 06:56:25 am »
When reviewing the cc's code, I think these can be refined.

1, in parser.cpp line 539
Code
        if (!m_IsPriority)
        {
            TRACE(_T("Parse() : Parallel Parsing %s"), bufferOrFilename.wx_str());

            // Add a task for all project files
            if (m_IsFirstBatch)
            {
                m_IsFirstBatch = false;
                m_PoolTask.push(PTVector());
            }

            if (m_IsParsing)
                m_Pool.AddTask(thread, true);
            else
                m_PoolTask.back().push_back(thread);
        }
        else if (m_IsPriority)

m_IsPriority is a bool variable.

2, in tokenizer.h line 470
Code
bool                 m_IsOperator;
this variable is not used any more.
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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: cc code refine
« Reply #1 on: May 29, 2011, 08:38:23 am »
Please provide a patch which removes it, so people can test it:)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: cc code refine
« Reply #2 on: May 29, 2011, 09:34:28 am »
Done!  :D

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5721
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: cc code refine
« Reply #3 on: May 29, 2011, 01:15:25 pm »
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.