Author Topic: convert "." to "->"  (Read 26189 times)

Offline rhf

  • Multiple posting newcomer
  • *
  • Posts: 123
Re: convert "." to "->"
« Reply #15 on: October 28, 2009, 03:25:15 pm »
Similar thing happens occasionally when changing a variable name in some function. After changing the name and hitting the "up" key 3-4 times (to get to the next line containing the name), you find yourself only scrolling through some flipping popup menu instead of moving the cursor. By the time you've stopped shouting and hitting your monitor with the keyboard, you have forgotten what you actually wanted to change.
Perhaps Thomas is a little harsh, but I definitely agree with the above complaint, which is very irritating. I would much prefer to have the Up/Down keys move the cursor up or down in the file - not in the popup menu. Perhaps a different key sequence could be used for scrolling the popup menu. (By the way, I know I can turn CC off, but I often find it useful.)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: convert "." to "->"
« Reply #16 on: October 28, 2009, 04:38:49 pm »
Similar thing happens occasionally when changing a variable name in some function. After changing the name and hitting the "up" key 3-4 times (to get to the next line containing the name), you find yourself only scrolling through some flipping popup menu instead of moving the cursor. By the time you've stopped shouting and hitting your monitor with the keyboard, you have forgotten what you actually wanted to change.
Perhaps Thomas is a little harsh, but I definitely agree with the above complaint, which is very irritating. I would much prefer to have the Up/Down keys move the cursor up or down in the file - not in the popup menu. Perhaps a different key sequence could be used for scrolling the popup menu. (By the way, I know I can turn CC off, but I often find it useful.)
Yes, sometimes, the codecompletion list windows was annoying, when I have finished enter the variable name, but they still exist there, I need to press "ESC" key to the suggestion list window closed. If not, arrow up and arrow down can only scroll the list, not the caret in the editor. :(



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 blueshake

  • Regular
  • ***
  • Posts: 459
Re: convert "." to "->"
« Reply #17 on: October 29, 2009, 12:55:23 am »
As I know, there is a way to add key sequence to cancle the suggestion window.Maybe we can use it.
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?

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: convert "." to "->"
« Reply #18 on: August 27, 2010, 10:58:28 am »
100% make it configurable, so I can disable it  :lol:
If we support smart pointer fully, we need this feature.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: convert "." to "->"
« Reply #19 on: August 27, 2010, 11:10:02 am »
Loaden, why, can you show an example?

Code
struct some_class { int get(); }
smart_ptr<some_class> p(new some_class);

p->  <--- I want to get the list with some_class's members
p.    <--- I want to get the list with smart_ptr's members

And p.get() is pretty valid and I don't want to be rewritten to p->get()!

Please don't make me fight my IDE and make this option configurable :)

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

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: convert "." to "->"
« Reply #20 on: August 27, 2010, 11:23:37 am »
Loaden, why, can you show an example?

Code
struct some_class { int get(); }
smart_ptr<some_class> p(new some_class);

p->  <--- I want to get the list with some_class's members
p.    <--- I want to get the list with smart_ptr's members

And p.get() is pretty valid and I don't want to be rewritten to p->get()!

Please don't make me fight my IDE and make this option configurable :)



The variable 'p', it is *not* a pointer!
So, If we enter "p.", “." can not be changed to "->", because it's not pointers.

We need to judge what the back of the variable "p".
If there is a dot ("."), we need show smart_ptr's members.
else, we need show some_class's members.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: convert "." to "->"
« Reply #21 on: August 27, 2010, 12:57:02 pm »
how well did the . ==>  -> on regular pointers work ?

Could we have an up to date patch to try it out ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: convert "." to "->"
« Reply #22 on: August 27, 2010, 01:15:03 pm »
If we support smart pointer fully, we need this feature.
Why we need this feature? One reason please?
I've shown you, that this feature is pretty useless for smart pointers.

Don't try to make the IDE/CC too smart, you'll fail for sure,
because the IDE is not directly connected with the user's brain
and it doesn't know what he/she is thinking when doing something
and what are his/her intentions.
(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!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: convert "." to "->"
« Reply #23 on: August 27, 2010, 01:57:49 pm »
Why we need this feature? One reason please?
I agree with oBFusCATed in this point. Especially trying to detect "smartly" if the user really means a pointer or not is really error prone. It's the job of the compiler to detect such kind of errors, not CC's.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: convert "." to "->"
« Reply #24 on: August 27, 2010, 02:50:17 pm »
Please waiting, I will try implement smart pointer parsing.
Currently, there does not need this feature.

If we really need this feature in future, it certainly can be configured, and is not selected default.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: convert "." to "->"
« Reply #25 on: August 28, 2010, 12:04:07 am »
Why we need this feature? One reason please?
The only reason I can imagine, honestly, is if you can't tell the difference between pointers and objects in your code. But then you have a totally different problem.

I'd really like to avoid having to fight with the IDE every single time.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: convert "." to "->"
« Reply #26 on: August 28, 2010, 01:11:54 am »
If we support smart pointer fully, we need this feature.
Why we need this feature? One reason please?
In fact, this feature is very convenient, enter "." very easy, enter "->" have to some difficulties.
Qt Creator also has this feature.
« Last Edit: August 28, 2010, 01:13:34 am by Loaden »