gpt4 book ai didi

c++ - 是什么让这个头文件让 VS2005 慢得像爬行一样? (智能感知无罪?)

转载 作者:可可西里 更新时间:2023-11-01 15:24:59 26 4
gpt4 key购买 nike

我正在使用 Compile Time Hashing technique I found here 试验一个 C++ 项目.宏按预期工作,编译时间合理,但 64 个递归宏似乎与 Visual Studio 的 Intellisense 玩得很不愉快。每次简短编辑后,IDE 都会挂起约 30 秒。我怀疑它正在尝试解析嵌套的宏。一旦我删除 #include "consthashmacro.h 行,响应就会恢复正常。

有没有办法为特定的头文件禁用 Intellisense?

我找到了这篇标题为 "Controlling IntelliSense Through Macros" 的文章,但那里的解决方案似乎也不适合我。

也许这不是智能感知?它肯定与该 header 有关。有什么想法吗?

编辑:
我尝试通过 renaming the feacp.dll as recommended 完全禁用 Intellisense .我得到了相同的行为 - 编辑导致 IDE 长时间挂起。删除 header 可恢复性能。 VS2055 的其他哪些功能可能导致这种令人难以置信的延迟?

重现:
使用 Visual Studio 2005,使用默认设置(即:使用预编译 header )创建一个新的“Win32 控制台应用程序”。将以下代码添加到 cpp 文件中。 (将“consthashmacro.h”提取到源目录中(可从 Chris Savoie 网站上的 zip file 获得)

#include "stdafx.h"

#define CONSTHASH(s) ((s)[0])
//#include "consthashmacro.h"

void Send(long hash, long value)
{
printf("Sending %x %x\n", 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 时,性能变慢了。

最佳答案

我是正确的,某些东西卡在递归宏上,但这不是 IntelliSense。罪魁祸首竟然是免费版Refactor! for C++ from DevExpress这是我很久以前安装的(很少使用)。

当我卸载它时,IDE 性能恢复正常。我重新启用了 IntelliSense,它没有问题。

我想向 IntelliSense 正式道歉:我很遗憾我对你进行了不公平的诽谤。

关于c++ - 是什么让这个头文件让 VS2005 慢得像爬行一样? (智能感知无罪?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7032551/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com