News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Hey, guys, I have a good idea!

Started by Loaden, January 26, 2010, 01:20:32 AM

Previous topic - Next topic

Loaden

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]

TerryP

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.
Just Another Computer Geek

ollydbg

blueshake has suggested that feature before, but there are objections.
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.

Loaden

#3
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!

nanyu

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.


blueshake

Quote"Qt Creator"

@Loaden

since Qt Creator can do this , I think cc can do this in the future too. :D
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

oBFusCATed

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
(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!]