Author Topic: Code Completion fails to show tips .  (Read 3418 times)

Offline hooluupog

  • Multiple posting newcomer
  • *
  • Posts: 16
Code Completion fails to show tips .
« on: March 25, 2012, 07:48:32 am »
I am using Code::Blocks nightly build 7789(update from stable build 10.05).  FYI, mingw gcc -version gcc (tdm-1) 4.6.1,gdb 7.3
The code completion always fails in such cases: :'(
Case 1:
Code
//--------------MyException.h-----------------
#include <string>
class MyException
{
    public:
        virtual std::string getwhat() = 0;
};

class MyDivideZero : public MyException{
    public:
        std::string getwhat()
        {
            return "Divide By Zero.";
        }
};

class MyTooLarge : public MyException{
    public:
        std::string getwhat()
        {
            return "Too Large Number.";
        }
};
Code
//-------------------------main.cpp-----------------
#include "MyException.h"
#include <iostream>
using namespace std;
 int main(){
        try{
              cout<<"It's a test."<<endl;
        }catch(MyException& e)
        {
            cout<<e.getwhat()<<"\n"; //       code completion fails showing getwhat() method.  After i write 'e.' ,it shows nothing.
        }
    }

Case 2:

Code
//-----------------------StrInt.h-----------------
#include <iostream>
#include <string>
class StrInt{
        std::string _num;
    public:
        StrInt(const std::string& a = "0");
};
Code
//--------------------StrInt.cpp-----------------
#include "StrInt.h"
StrInt::StrInt(const std::string& a) : _num(a)
{
    if (a.length()==0) ;  //     code completion fails showing length() method. After i write 'e.' ,it shows nothing.
}
« Last Edit: March 25, 2012, 08:15:51 am by hooluupog »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5371
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Code Completion fails to show tips .
« Reply #1 on: March 27, 2012, 02:39:15 am »
Hi, thanks for the example, can you please file a bug report in our berliOS site?

Thus, I can track it and manage it. (the bug won't lost in our forum)

Thank you!
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 hooluupog

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Code Completion fails to show tips .
« Reply #2 on: March 27, 2012, 05:50:37 am »
OK. i will do that. Wish the next stable release have a handy CC. :)
BTW,is there a real-time syntax error checking function(just like the eclipse cdt does) for C::B in the near future? It will be amazing.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5371
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Code Completion fails to show tips .
« Reply #3 on: March 27, 2012, 01:06:19 pm »
OK. i will do that. Wish the next stable release have a handy CC. :)
Thanks.

Quote
BTW,is there a real-time syntax error checking function(just like the eclipse cdt does) for C::B in the near future? It will be amazing.
I don't think it is easy to implement. Currently no such plan is made. Can you help us?  :)
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 arprog

  • Single posting newcomer
  • *
  • Posts: 8
Re: Code Completion fails to show tips .
« Reply #4 on: March 27, 2012, 02:21:27 pm »
#define String std::string

String str;
str. < fail

and

typedef std::string String;

String str;
str. < fail

[CodeBlocks svn 7789]

P.S. CodeBlocks the best!

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5371
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Code Completion fails to show tips .
« Reply #5 on: March 27, 2012, 02:44:36 pm »
#define String std::string

String str;
str. < fail

and

typedef std::string String;

String str;
str. < fail

[CodeBlocks svn 7789]

P.S. CodeBlocks the best!

Ok, I test it and find that it does not work. (I presume it should work)

So, please file another bug. Thanks.
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.