Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
typedef to class?
blueshake:
hello:
in this thread ,http://forums.codeblocks.org/index.php/topic,10641.0.html
the typedef problem can not be solved.
codes like this:
--- Code: ---#include <iostream>
using namespace std;
class Pt
{
public:
int x;
int y;
};
typedef Pt subpt;
typedef subpt sub;
int main()
{
sub pp;
pp. // not work here.
cout << "Hello world!" << endl;
return 0;
}
--- End code ---
pp get nothing.
I think can use this patch.
but I not sure it is right or not to do this.
here is the patch.
--- Code: ---Index: parserthread.cpp
===================================================================
--- parserthread.cpp (revision 5730)
+++ parserthread.cpp (working copy)
@@ -1707,15 +1737,60 @@
#if PARSER_DEBUG_OUTPUT
Manager::Get()->GetLogManager()->DebugLog(F(_("Adding typedef: name='%s', ancestor='%s'"), components.front().c_str(), ancestor.c_str()));
#endif
- Token* tdef = DoAddToken(tkTypedef, components.front(), lineNr, 0, 0, args);
+ Token* tdef = DoAddToken(tkClass, components.front(), lineNr, 0, 0, args);
--- End code ---
and pp has the tip now.see the attachment.
any comment???
ollydbg:
Your attachment is 0kb? :(
blueshake:
sorry.I just upload the pic,see the attachment.
[attachment deleted by admin]
MortenMacFly:
--- Quote from: blueshake on August 12, 2009, 02:56:11 am ---any comment???
--- End quote ---
..does it still work if you make a type out of a struct using a typedef?
Meaning: Does the struct and the typedef still code-complete?
blueshake:
yes,i think so.
here is the test codes.
--- Code: ---typedef unsigned int unlong;
typedef class cls
{
int xx;
int yy;
}clssub;
int main()
{
sub pp;
unlon
cout << "Hello world!" << endl;
return 0;
}
--- End code ---
the unlong can be recognized correctly.
see the attachment.
my confuse is if use this ,it seems that the tkTypedef will have no use any more.
[attachment deleted by admin]
Navigation
[0] Message Index
[#] Next page
Go to full version