4 ms·
>> I hear VS>=2010 uses the compiler infrastructure to generate the intellisense data, rather than doing it (as VS<=2008) by simple text processing, and it's m
by int_19h 13y ago
>> I hear VS>=2010 uses the compiler infrastructure to generate the intellisense data, rather than doing it (as VS<=2008) by simple text processing, and it's made a huge difference in terms of reliability.
To be specific, what they did was take the EDG C++ front-end, and use it to drive all code intelligence features (code completion etc) - see http://blogs.msdn.com/b/vcblog/archive/2009/05/27/rebuilding-intellisense.aspx http://blogs.msdn.com/b/vcblog/archive/2009/05/27/rebuilding.... That's why it can correctly handle all templates, macros etc.
Here's a nasty trick that I love to play on unsuspecting C++ IDEs:
template<int = sizeof(void*)> struct foo;
template<> struct foo<4> {
template<int> struct bar {};
};
template<> struct foo<8> {
enum { bar = 0 };
};
float baz;
int main() {
foo<>::bar < 123 > baz;
}
The nastiness here is that the line of code inside main() should be parsed differently depending on pointer size on the target architecture. If it uses foo<4>, then it is a declaration of a local variable named baz, of type foo<4>::bar<123>. If it uses foo<8>, then it's an expression involving two comparison operators: ((foo<>::bar < 123) > baz) - referencing the global float baz.
Now, if you try the above in VS (2010+), you'll see that it will parse this correctly and give you the proper type info for baz (and "Find References" etc), which will change if you switch project configuration from "Win32" to "x64" and back.