Does anyone know why Visual Studio 2008's Intellisense is acting funny?
If I say BEGIN_MSG_MAP
, I get this:
If I say BEGIN_MSG_MAP_FOO
, I get this:
Either way, the macros are all undefined, so what's the deal?
And nope, I am not using Force In开发者_JAVA百科clude anywhere, so this is the actual entire source file -- there's virtually nothing defined, as shown below:
Maybe END_MSG_MAP()
has a }
which closes the scope of CMyDialog
, hence test()
will be in the global scope. Look at the drop down lists. It is precisely that.
Notice: this answer is based entirely on speculation, if someone posts a good answer based on actual knowledge of how IntelliSense works I'll be glad to upvote it and delete mine.
I suppose that IntelliSense has some special case to handle by default the most common MFC/ATL macros, or maybe it supposes that some default headers may be included to be able to handle the fact that your file, even if it doesn't include the MFC headers, could be included in a .cpp
where such default headers are already included (which is often seen in headers, even if they should be including their dependencies).
But being BEGIN_MSG_MAP_FOO
a completely unknown macro, it starts acting funny because it is actually an unknown identifier, probably interpreted as some unknown macro that could close the current scope. Thus, after it, it "plays it safe" and restarts parsing as it was the beginning of a new file, and thinks that test
is a global function (as testified by the upper-left combobox), where this
makes no sense.
精彩评论