User forums > Using Code::Blocks

How to detect and auto change to ->

(1/2) > >>

ocdmonkey:
Unfortunately a library I have decided to use will require me to use ->. Now, I heard that there is a plugin for MSVC that will automatically change . to -> when appropriate, and am hoping there is some way to get the same effect in Code::Blocks. Any help would be greatly appreciated.

Have a good day!
Peter

BlueHazzard:

--- Quote from: ocdmonkey on January 29, 2015, 05:40:59 pm ---Unfortunately a library I have decided to use will require me to use ->. Now, I heard that there is a plugin for MSVC that will automatically change . to -> when appropriate, and am hoping there is some way to get the same effect in Code::Blocks. Any help would be greatly appreciated.

--- End quote ---

No, there is no automated way... Probably it would be better if you understand why you have to use "." or "->", because that are two fundamental different things, and handling it wrong will give you A LOT RUNTIME ERRORS, security holes, and crashes....

greetings

ocdmonkey:
I know why I have to use it, I just think it's overly clunky to type and don't understand why whoever came up with the C language decided they needed to differentiate it between normal variables and pointers.

Anyway, if there isn't a way to automatically do it, I'll just create a keyboard shortcut somehow to make it easier to type.

Have a good day!
Peter

thomas:
In the OP's defense, one has to admit that there really is no good reason why there is such a distinction. The compiler already knows whether a type is of pointer type or not, so the standard could as well allow the "dot" member access operator in either case.
Of course operator overloading would have to be somewhat different too, to allow for smart pointers and such.

Alas, it is what it is  :D

raynebc:
I was going to suggest observing C::B's code completion, but it doesn't look like that will differentiate between the two.

Navigation

[0] Message Index

[#] Next page

Go to full version