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?
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?
EDIT:
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?
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\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;
}
When I replace the #define CONSTHASH
with the include line underneath it, performance slows to a crawl.
Tools > Options > Text Editor > C/C++ > Advanced
I see options to disable IntelliSense and such, aren't those available in VS2005? – Foramen