是什么让这个头文件慢了 VS2005 的爬行?(IntelliSense 无罪?)
我正在使用我在此处找到的编译时散列技术来试验一个 C++ 项目.宏按预期工作,编译时间合理,但 64 个递归宏似乎在与 Visual Studio 的 Intellisense 玩地狱.每次简短编辑后,IDE 都会挂起约 30 秒.我怀疑它正在尝试解析嵌套的宏.一旦我删除 #include "consthashmacro.h
行,响应就会恢复正常.
I was experimenting with a C++ project using the Compile Time Hashing technique I found here. The macros work as expected, and the compile time is reasonable, but the 64 recursive macros seem to being playing hell with Visual Studio's Intellisense. After every short edit, the IDE hangs for ~30 seconds. I suspect that it is getting wound up trying to parse the nested macros. As soon as I remove the #include "consthashmacro.h
line, responsiveness returns to normal.
有没有办法为特定的头文件禁用智能感知?
Is there a way to disable Intellisense for a specific header file?
我发现这篇文章的标题是 通过宏控制 IntelliSense",但那里的解决方案似乎对我来说也不能正常工作.
I've found this article titled "Controlling IntelliSense Through Macros", but the solution there does not seem to be working correctly for me either.
也许不是智能感知?它肯定与那个标题有关.有什么想法吗?
Perhaps it's not intelliSense? It's definitely related to that header. Any ideas?
我尝试通过 按照建议重命名 feacp.dll.我得到相同的行为 - 编辑导致 IDE 长时间挂起.删除标头可恢复性能.VS2055 的其他哪些功能可能会导致这种令人难以置信的延迟?
I tried disabling Intellisense entirely by renaming the feacp.dll as recommended. I get the same behavior - edits cause the IDE to hang for long periods. Removing the header restores performance. What other feature of VS2055 could be causing this incredible lag?
复制:
使用 Visual Studio 2005,使用默认设置(即:使用预编译头文件)创建一个新的Win32 控制台应用程序".将以下代码添加到 cpp 文件中.(将 'consthashmacro.h' 提取到源目录(可从 zip 文件获得)a> 在 Chris Savoie 的网站上)
To Reproduce:
Using Visual Studio 2005, Create a new "Win32 Console Application" with the default settings (i.e: using precompiled headers). Add the following code to the cpp file. (Extract 'consthashmacro.h' into the source directory (available from the zip file at Chris Savoie's site)
#include "stdafx.h"
#define CONSTHASH(s) ((s)[0])
//#include "consthashmacro.h"
void Send(long hash, long value)
{
printf("Sending %x %x
", hash, value);
}
#define QQuot_(x) #x
#define QQuote(x) QQuot_(x)
#define Debug_Print(s, v) (Send( CONSTHASH(QQuote(__LINE__)##s), *((long*)&(v))))
int _tmain(int argc, _TCHAR* argv[])
{
int i = __LINE__;
float f= 3.14f;
Debug_Print("This is a test %d", i);
i++;
Debug_Print("This is a test %d", i);
Debug_Print("This was test %f", f);
return 0;
}
当我用它下面的包含行替换 #define CONSTHASH
时,性能会变慢.
When I replace the #define CONSTHASH
with the include line underneath it, performance slows to a crawl.
推荐答案
我是正确的,递归宏上挂了一些东西,但不是 IntelliSense.罪魁祸首竟然是 Refactor!用于 DevExpress 中的 C++,我已经安装了很久(并且很少使用).
I was correct that something was getting hung up on the recursive macros, but it wasn't IntelliSense. The culprit turned out to be the free version of Refactor! for C++ from DevExpress that I had installed a long while ago (and rarely used).
当我卸载它时,IDE 性能恢复正常.我重新启用了 IntelliSense,它可以正常工作.
When I uninstalled that, IDE performance returned to normal. I re-enabled IntelliSense, and it works with no problems.
我想向 IntelliSense 正式道歉:我很抱歉我对你进行了不公平的中伤.
I would like to offer a formal apology to IntelliSense: I regret that I cast unfair aspersions upon you.
相关文章