Author Topic: Bug in CC (maybe)  (Read 4475 times)

Max

  • Guest
Bug in CC (maybe)
« on: December 21, 2010, 01:52:47 pm »
Dear devs,

I'm reporting a bug in CC. It is present since the first nigthly related to the new CC interface but now I'm able to attach a short testcase.

I'm using 6900 (debugging branch) , Windows XP GCC MinGW 4.5.0.


Open the testcase archive and load the project. Open the file fooClass.cpp and put the cursor in line 7 (inside the constructor).

1) Write "m_foo". The completion suggestion related to the variable m_fooMemberData should appear. It doesn't!!

2) Now write "fooClass::m_foo"; this time you get the right completion suggestion.

Why I'm not getting the suggestion in the first case?


3) Delete line 4 and 46 of the file fooClass.h and line 3 of the file fooClass.cpp (all the lines related to the namespace foo) and save the files. Now the code completion suggestion works both using "m_foo" and "fooClass:m_foo".

So it should be related to the managment of the namespaces.

Becasue I'm always using a namespace the use of the CC is pretty ugly.

Hope this helps

Max

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5370
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Bug in CC (maybe)
« Reply #1 on: December 21, 2010, 02:29:57 pm »
confirmed. we will check it.
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5370
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Bug in CC (maybe)
« Reply #2 on: December 23, 2010, 10:27:29 am »
I have debugged a while, and found that for the code:

Code
using namespace foo;

fooClass::fooClass()   //************ONE************
{

}


fooClass::~fooClass()
{

}

When we are here in the ONE place, we try to find the "fooClass" in the global namespace, so this was not correctly. at least we should try to consider the scope invoked by the using statement:

Code
using namespace foo;

I think I have answered this kind of question several months ago.

But currently, it was quite complex to do this.

I suggest you can use this way:

Code
namespace foo   // open the foo namespace
{

fooClass::fooClass()   //************ONE************
{

}


fooClass::~fooClass()
{

}

} close the namepsace
this should works.



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.

Max

  • Guest
Re: Bug in CC (maybe)
« Reply #3 on: December 23, 2010, 12:57:04 pm »
I just tested one class and the proposed workaround worked. Becasue the using statement is a common coding style in implementation files it will be welcome to fix the CC in future. In the meantime, because I think CC deserve to be used, I'm going to update my projects...

Thx

Max