2

C++, VS 2012 (but the same thing happened in previous versions of VS).

Sometimes, the Intellisense finds "problems" that aren't really problems and puts its red squigglies under perfectly valid code.

Example:

class A {
  A(const A&);
  A& operator=(const A&);
public:
  A(const wchar_t*, const wchar_t*, int);
#define AMsg(x) A(x, __FILEW__, __LINE__)
};

...

throw AMsg(L"abc");

The AMsg macro converts into a ctor call, saving one typing the obvious last two parameter values, the code works as expected, yet the Intellisense puts a red squiggly under AMsg saying that A::A(const A&) is inaccessible. A::A(const A&) is inaccessible, yes, but AMsg calls a different ctor, and the Intellisense fails to see that.

Is there a way to somehow make the Intellisense just ignore AMsg? I remember we could, for example, edit the keyword list for the editor which was stored in a file, maybe there is some file or macros (e.g., a "do not parse the contents of this particular file" one?) that helps control the Intellisense?

4

1 回答 1

1

“问题”是 Intellisense 编译器建立在 EDG 的编译器之上,而不是 MSVC 本身。EDG 的编译器更接近标准,这意味着它今天可以捕捉到 MSVC 明年可能会捕捉到的问题。

无法在部分代码库上打开或关闭 Intellisense。那是没有意义的。假设它会忽略int foo(int),然后编译器将包含int foo(int)在重载决议中。你的整个程序可能会改变。

于 2013-08-13T08:04:54.180 回答