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.

Code
#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:
Code
p.testMsg();
to:
Code
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
blueshake has suggested that feature before, but there are objections.

But such tips is clearly a very ridiculous!
p.testMsg();
Code
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
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