Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: Loaden on January 26, 2010, 01:20:32 AM

Title: Hey, guys, I have a good idea!
Post by: Loaden on January 26, 2010, 01:20:32 AM
For example this code, 'p' is a pointer, and 'a' is a value.
If type "p." or "a.", they show the same results.

#include <iostream>

class A
{
public:
   A();
   ~A();

   void testMsg() {}

private:
   int iLoveYou;
};

int main()
{
   A* p = new A;
   A a;
   a.testMsg();
   return 0;
}


Because CC can identified a pointer, or value, so we can do that:
If it is a pointer, then automatically replace from "." to  "->", like this:
form:
p.testMsg();
to:
p->testMsg();

[attachment deleted by admin]
Title: Re: Hey, guys, I have a good idea!
Post by: TerryP on January 26, 2010, 01:37:24 AM
Useful, might I also suggest handling an accidental ',' as well?

*groans* I still remember spending trying to figure out a compiler error, over an x,y typo, after an 8~12 hour straight coding run.
Title: Re: Hey, guys, I have a good idea!
Post by: ollydbg on January 26, 2010, 02:57:42 AM
blueshake has suggested that feature before, but there are objections.
Title: Re: Hey, guys, I have a good idea!
Post by: Loaden on January 26, 2010, 03:35:01 AM
Quote from: ollydbg on January 26, 2010, 02:57:42 AM
blueshake has suggested that feature before, but there are objections.

But such tips is clearly a very ridiculous!
p.testMsg();
int main()
{
   A* p = new A;
   p.testMsg();
   return 0;
}


Both of "Qt Creator" and "Visual Assist X" selected from the "." To "->" conversion.
I hope CC team to re-consider this feature.
Thanks!
Title: Re: Hey, guys, I have a good idea!
Post by: nanyu on January 26, 2010, 06:54:00 AM
but how about the "smart pointer"?

std::auto_ptr<MyStruct>  ap (new MyStruct());

ap. ?? //now the cc show thoese tips:
     release()
     get()

ap->  //show nothing.

Title: Re: Hey, guys, I have a good idea!
Post by: blueshake on January 27, 2010, 02:14:30 PM
Quote"Qt Creator"

@Loaden

since Qt Creator can do this , I think cc can do this in the future too. :D
Title: Re: Hey, guys, I have a good idea!
Post by: oBFusCATed on January 27, 2010, 03:38:25 PM
Quote from: nanyu on January 26, 2010, 06:54:00 AM
but how about the "smart pointer"?

std::auto_ptr<MyStruct>  ap (new MyStruct());

ap. ?? //now the cc show thoese tips:
     release()
     get()

ap->  //show nothing.


CC Doesn't support operator overloading