我正在使用Compile Time Hashing technique I found here試驗C++項目。這些宏按預期工作,編譯時間合理,但64個遞歸宏似乎正在用Visual Studio的Intellisense玩弄地獄。在每次短暫編輯之後,IDE掛起約30秒。我懷疑它試圖解析嵌套的宏已經結束了。只要我刪除#include "consthashmacro.h
行,響應恢復正常。什麼使這個頭文件緩慢VS2005爬行? (智能感知無罪?)
有沒有辦法來禁用特定頭文件的智能感知?
我發現這篇文章的標題爲"Controlling IntelliSense Through Macros",但那裏的解決方案似乎對我來說似乎沒有正常工作。
也許它不是智能?這絕對與該標題有關。有任何想法嗎?
編輯:
我試圖完全由renaming the feacp.dll as recommended禁用智能感知。我得到相同的行爲 - 編輯會導致IDE長時間掛起。刪除標題可以恢復性能。 VS2055的其他功能可能會導致這個難以置信的滯後?
重現:
使用Visual Studio 2005,創建一個新的 「Win32控制檯應用程序」 使用默認設置(即:使用預編譯頭)。將下面的代碼添加到cpp文件。 (摘自「consthashmacro.h」到源代碼目錄(可從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
,性能會變得非常緩慢。
項目是否使用預編譯頭文件?也許你可以試着把這個標題放在裏面。 – Praetorian
好主意,但(等待5分鐘後...)它不起作用。 – AShelly
在VS2010的'工具>選項>文本編輯器> C/C++>高級'我看到選項來禁用智能感知等,不是在VS2005中可用? – nobody