开发者

Is Visual C++ intellisense "smarter" than the compiler

I have the following scenario.

I have a base class from which a class derives. Everything appears good however, every time I hover my mouse cursor over an inherited member of the base class, the intellisense shows it fine, EG BaseClass::SomeMember. However, when I try to compile, the compiler shows various errors(they are about the variables and member functions that the intellisense was reporting开发者_JAVA技巧 well). The compiler says 'they're not valid identifiers', that they don't 'belong to a global namespace'. Does anyone know why this is occurring?


If this is VC2010, then yes, in a sense Intellisense is smarter. They switched to using EDG's compiler frontend for IntelliSense, and that is a stricter, more standards-compliant compiler than Microsoft's own one. So there are cases where IntelliSense and the "real" compiler disagrees.

Sometimes IntelliSense is wrong because it doesn't have the complete picture (it runs in a different context, and processes only small snippets of the code at a time), and sometimes Intellisense is right and the compiler is wrong (in terms of C++ standard compliance), because EDG's frontend is just better in that respect.


No, the intellisense is definitely not smarter. Your code is broken. Ask a separate question with the relevant parts of the code and the error messages you are getting.


It depends on your definition of "smarter". Intellisense is not a full-blown compiler, but it will have all sorts of heuristics built into it, to help it deal with invalid code. If it it didn't have these, then it would be completely useless.

But these heuristics are ultimately just guesses; sometimes they will be misleading or wrong.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜