LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   ? about code completion tool. -> (https://www.linuxquestions.org/questions/programming-9/about-code-completion-tool-408240/)

RHLinuxGUY 01-26-2006 11:07 AM

? about code completion tool. ->
 
I opened up Dev-C++ on my win computer at school and it came up with a tip of the day, and it was use the code completion tool. And it showed a few of the following: "...", "." and "->". I have seen "->" before, how would I use this? Apparently it stores commands(?) in cache so you can use it once more in your code immediatly without having to type it all out(?). I'm guessing for like large function names or etc. Can someone clarify this? And how would I use it? When?

SaintsOfTheDiamond 01-26-2006 12:00 PM

Are you talking about in the code? The "->" is used for accessing and manipulating data with pointers. :scratch:

I used Dev C++ when I'm working in Windows but I've never configured the code completion thing, so I guess I'm just spamming here. :D

xhi 01-26-2006 12:13 PM

its not saying that you can program '->' like a macro or somthing.. it was giving you a list of what activates the code completion..

when you setup devc++ it will take a minute and scan all the system header files and create a completion database.. when you use a standard function, string for example.. it will pop up a prototype for you and if you hit enter it will complete the rest of the function.. example.

string s="hello";
s.le <---- now is when it should pop up the completion dialog hit enter and
s.length() it saves you some typing..
or if you were to be going through a pointer to a string..
s->le <--- again it should popup and let you hit enter..

though my version of devc++ i run in vmware sometimes usually does not work so well, it only pops up a protpotype after i finish typing.. ??

also i think it will also scan in you header files you create as you go.. its a nice little feature esp if you are not well versed in a particular set of functions... you can configure it somewhere in the editor options..

hth

RHLinuxGUY 03-05-2006 11:36 PM

My apologies for reviving a dead topic. I came across this in my SDL .cpp file(s)...

if (image->format->palette && screen->format->palette) {
SDL_SetColors(screen, image->format->palette->colors, 0,
image->format->palette->ncolors);

... So how does the -> (i.e. image->format->palette) work? Is it exactly like the auto complete feature like in dev-c++ or is that a negative? If negative, then what exactly is used for? Thank you in advance!!!

xhi 03-05-2006 11:49 PM

in my experience i have not seen the auto complete work very well on additional headers.. such as the SDL headers..

so if you type image-> . . you are more than likely not going to have the auto complete come up..

however if you are using it on a class that you defined.. then it does usually work as expected..

i guess that is what you are asking ??

RHLinuxGUY 03-06-2006 12:13 AM

I think so.. I don't even exactly know what it is, other then what you told me. Thats why I asked. So I guess what you think I am asking is what I am asking. Viciouse cycle. Anyways.. it works.. but I don't remember defining it, maybe SDL does it automagicaly like the rest of their wonders. Anyways, so far I have an idea, but it seems as though it is not exactly KNOWN around here. I have searched the net but failed to bring any resources regarding it. Other then you and dev-c++ I don't have anything else to help me understand and use it properly in the future. Thank you so far though xhi, because even though you may not think your giving me the full answer you think I want, you pushed me in the direction I need to go.

xhi 03-06-2006 12:32 AM

Code:

Anyways.. it works.. but I don't remember defining it,
you are aware that '->' is a c/c++ operator correct?

im not trying to get to 'spoon-feedishly' here.. and if you already know this just ignore it.. but i wonder after rereading the post if i had been misunderstanding you..

again just ignore this post if you already knew..

move along folks.. nothing to see here.. :)

this may become part of the "Viciouse cycle"


All times are GMT -5. The time now is 04:49 AM.