开发者

Why is this breaking Visual Studio's Intellisense?

开发者 https://www.devze.com 2023-04-06 03:06 出处:网络
Does anyone know why Visual Studio 2008\'s Intellisense is acting funny? If I say BEGIN_MSG_MAP, I get this:

Does anyone know why Visual Studio 2008's Intellisense is acting funny?

If I say BEGIN_MSG_MAP, I get this:

Why is this breaking Visual Studio's Intellisense?

If I say BEGIN_MSG_MAP_FOO, I get this:

Why is this breaking Visual Studio's Intellisense?

Either way, the macros are all undefined, so what's the deal?

Why is this breaking Visual Studio's Intellisense?

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:

Why is this breaking Visual Studio's Intellisense?


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.

0

精彩评论

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

关注公众号