User forums > Using Code::Blocks

Another code completion problem

(1/3) > >>

zabzonk:
I have a problem with nightly 7289 on Windows 7. For this code:

#include <string>
using namespace std;

int main()
{
     string s;
}

code completion on s works perfectly. Whereas for this code:

#include <string>
using std::string;

int main()
{
     string s;
}

code completion on s does not work at all. Is this a known issue? I did try searching for it, but there are a hell of a lot of posts about completion.
 

ollydbg:

--- Quote from: Neil Butterworth on August 13, 2011, 05:49:16 pm ---Whereas for this code:
#include <string>
using std::string;

int main()
{
     string s;
}

code completion on s does not work at all. Is this a known issue?

--- End quote ---
Yes, this is an issue, and it is an issue exists for a long time.
But I think it is hard to solve this issue. There is no easy way to solve this issue. But I would think that when the parser see:

--- Code: ---using std::string;
--- End code ---
it would add "namespace std" scope instead. but this is only a workaround, because all the other classes under "std" will be added to the context. any comments?

zabzonk:
Well, that's really unfortunate, because it makes CB uncompetitive with VC++, at least in this area. Both code samples do work correctly in VC++ 2010, and it seems not to use the "include entire namespace hack" you suggest. That means that the problem is soluble, and I think it is an important one. I recommend CB very strongly in all my posts and blogging about C++, but if a major language feature like this is not supported, I may have to tone this down :-( Well, at least CB's FOSS competitor CodeLite doesn't seem to get it right either...

ollydbg:

--- Quote from: Neil Butterworth on August 14, 2011, 09:14:58 am ---I may have to tone this down :-( Well, at least CB's FOSS competitor CodeLite doesn't seem to get it right either...

--- End quote ---
what does this sentence means? did you say the same problem exists in Codelite or Not?
BTW: codelite has some extra feature to list the code suggestion. (in fact, it has its own code suggestion mechanism and also a clang supported mechanism).

zabzonk:
> what does this sentence means?

I mean that CodeLite appears to have the same problem that CB does - a

using std::string;

does not allow for code completion on string variables, but

using namespace std;

does.

Navigation

[0] Message Index

[#] Next page

Go to full version