2

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 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?

Rhexis
  • 2,414
  • 4
  • 28
  • 40
Yoss
  • 428
  • 6
  • 16
  • AFAIK they are two separate processes, so its possible that in some cases intellisense is going the extra mile to help you whereas the compiler is stricter – Doug T. Aug 31 '11 at 12:42
  • Can you provide a code sample? – Nemanja Trifunovic Aug 31 '11 at 12:43
  • 1
    That was discussed recently, so dig around SO a bit -- the frontend is licensed from EDG, which does the Intellisensing, but the compiler is Microsoft's own, and the two are quite different with respect to the very modern C++ features. – Kerrek SB Aug 31 '11 at 12:43
  • Also, what exactly are you trying to solve with your question. Do you want to know how to fix your compiler error? (if so post some code) Or are you just curious about intellisense (which might require someone from MS to answer)? – Doug T. Aug 31 '11 at 12:43
  • @Kerrek SB: True, but only for newer (2010?) releases. Another problem is that Intellisense doesn't account for all compiler settings. – MSalters Sep 01 '11 at 08:35

3 Answers3

8

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.

jalf
  • 243,077
  • 51
  • 345
  • 550
2

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.

Tamás Szelei
  • 23,169
  • 18
  • 105
  • 180
1

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.

Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680