Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
(Minor) improvement of CodeCompletion?
MortenMacFly:
--- Quote from: mandrav on October 26, 2005, 01:09:58 pm ---Here's a simple one:
--- End quote ---
Thanks! :D
Alright, I've had a look into VC6. I've used the following code:
--- Code: ---#include "stdafx.h"
#include <iostream>
typedef struct
{
int iMyInt;
long lMyLong;
}MyStruct;
typedef void(*func)();
void AFunction()
{
std::cout << "In AFunction()" << std::endl;
return;
}
int main(int argc, char** argv)
{
func f = AFunction;
f();
return 0;
}
--- End code ---
The result:
MyStruct and it's members is shown as a class in the class browser. Also codecompletion works for an instance ("ms"). The function typedef is ignored and not shown in the class browser. Is this handled as I proposed...?! MS seems to be is as lazy as I am. :lol:
So what to do from here? Is it worth giving a try? What do you (mandrav) think?
With regards,
Morten.
Edit: Did a mistake with quotes...
MortenMacFly:
--- Quote from: MortenMacFly on October 26, 2005, 01:32:06 pm ---The result:
--- End quote ---
I just gave a try to the same example using VS.NET from another student. There it is different. MyStruct is presented as "unnamed" struct (not "MyStruct"!) and "MyStruct" as well as "func" are shown with a typedef symbol without any members. Hence if I move the cursor over "func" (where the function is defined in main) the hint shows the complete typedef. If I move the cursor over an instance of "MyStruct" within main the hint shows "__unnamed_[address] MyStruct" and codecompletion works.
Now I am struggeling with my "construct". The inner part is intepreted as unnamed struct (which would then be right) and the outer part is therefore a typedef without members. I thought that this a right way do declare a new type (I've done it a lot and seen it a lot) but it seems not to be. It's suddenly becoming quite strange (at least for me that is)...
Now I am confused. :?
I think I should just shut up and stop wasting your time.
Morten.
mandrav:
--- Quote ---MyStruct is presented as "unnamed" struct (not "MyStruct"!)
--- End quote ---
This is correct. MyStruct is not a type itself but a typedef for the anonymous struct behind it. After being typedef'd it is a type, of course ;)
MortenMacFly:
...I know, I said I shut up... but... :D
--- Quote from: mandrav on October 26, 2005, 02:40:57 pm ---This is correct. MyStruct is not a type itself but a typedef for the anonymous struct behind it. After being typedef'd it is a type, of course ;)
--- End quote ---
Does that mean that
--- Code: ---typedef struct {...} MyStruct;
--- End code ---
is actually lazy syntax because it should better be:
--- Code: ---typedef struct MyStruct {...} MyTypedef;
--- End code ---
...and is just accepted by the generosity of the compiler?! I mean:
--- Code: ---struct {...};
--- End code ---
itself without a name generates a compiler error (of course).
Seems I am learning something I had never thought of...
Morten.
anonuser:
Does the Codecompletion plugin take scope into consideration?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version