开发者

Feedback: C++ developers who've switched to VS2010?

开发者 https://www.devze.com 2023-02-02 11:38 出处:网络
I\'m considering moving our shop over to VS2010 from VS2008sp1.I\'ve been very happy with 2008, but would like to make use of TR1 in our code.

I'm considering moving our shop over to VS2010 from VS2008sp1. I've been very happy with 2008, but would like to make use of TR1 in our code.


I'm really interested in fellow programmers gestalt of 2010 v. 2008, rather than the solution to any one element of the following!


However, I'm in the process of converting our projects & solutions, and I'm finding that the "noise to signal" ratio is rather lame, IMO. So far, I'm looking at rewiring every single project we have to get rid of the various apparently spurious Microsoft Build warnings, such as $(TargetExt) ... does not match the Linker's OutputFile property value ...

There are several variations on this message, several per project, and we have around 75 projects. I have little or no desire to waste my time redoing all of these projects output targets (Apparently MSBuild insists that the linker's target and the compiler's target be identical, which is neither necessary nor desirable for us).

Additionally, [embarrassment], we still use VSS. And just in my initial dealings with trying to massage the projects to compliance with MSBuild, I'm finding that the VSS interface in VS2010 is about 1/4 as fast as in 2008. It's atrocious (and I'm used to the relatively lame performance of VSS in general).

Sigh... I know about 1/2 or more of the "answers" are going to be "Stop using VSS." Yeah, that's a great idea, and we may migrate to subversion in the not too distant future. But one thing at a time. That only solves the VSS speed issue, not the MSBuild problems, nor the new C++ problems.

It seems that the new standard libraries and TR1 stuff has broken some of our code. That's not in itself too shocking - I'd have been surprised if that weren't the case. But as it stands, the error messages are LOOOONNNNNGGGG - it reminds me of my early days of trying to use the STL and having to load an error string parser helper that deduced the higher-level names for me so that the error messages could become somewhat useful. Now, 10 years later, I'm back to seeing diagnostics so deep and convoluted that they make no sense, and I have no idea what the real issue is. In one case I'm attempting to insert a new element in a multimap:

typedef CCimexDataSource::CategoryID                        CategoryID;
typedef std::multimap<CString, CCimexDataSource *>          description_sources_multimap;
typedef std::map<CategoryID, description_sources_multimap>  category_sources_map;
// attempt to insert a new description->CCimexDataSource* keyed by CategoryID (an unsigned)
m_category_sources_map[it->GetCategory()].insert(std::make_pair(it->GetDescription(), &(*it)));

And I get:

1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): error C2440: 'initializing' : cannot convert from 'const CCimexDataSource *' to 'CCimexDataSource *'
1>          Conversion loses qualifiers
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(255) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<_Ty,const CCimexDataSource>(_Other1 &&,_Other2 &&)' being compiled
1>          with
1>          [
1>              _Ty1=const CString,
1>              _Ty2=CCimexDataSource *,
1>              _Ty=ATL::CStringT<char,StrTraitMFC<char>>,
1>              _Other1=ATL::CStringT<char,StrTraitMFC<char>>,
1>              _Other2=const CCimexDataSource *
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(208) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<ATL::CStringT<BaseType,StringTraits>,const CCimexDataSource*>(std::pair<开发者_如何学运维;ATL::CStringT<BaseType,StringTraits>,const CCimexDataSource *> &&)' being compiled
1>          with
1>          [
1>              _Ty1=const CString,
1>              _Ty2=CCimexDataSource *,
1>              BaseType=char,
1>              StringTraits=StrTraitMFC<char>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory(280) : see reference to function template instantiation 'void std::allocator<_Ty>::construct<std::pair<_Ty1,_Ty2>>(std::pair<const _Kty,CCimexDataSource> *,_Other &&)' being compiled
1>          with
1>          [
1>              _Ty=std::pair<const CString,CCimexDataSource *>,
1>              _Ty1=ATL::CStringT<char,StrTraitMFC<char>>,
1>              _Ty2=const CCimexDataSource *,
1>              _Kty=CString,
1>              _Other=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(592) : see reference to function template instantiation 'void std::_Cons_val<std::allocator<_Ty>,_Ty,std::pair<_Ty1,_Ty2>>(_Alloc &,std::pair<const _Kty,CCimexDataSource> *,std::pair<_Ty1,_Ty2> &&)' being compiled
1>          with
1>          [
1>              _Ty=std::pair<const CString,CCimexDataSource *>,
1>              _Ty1=ATL::CStringT<char,StrTraitMFC<char>>,
1>              _Ty2=const CCimexDataSource *,
1>              _Alloc=std::allocator<std::pair<const CString,CCimexDataSource *>>,
1>              _Kty=CString
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(755) : see reference to function template instantiation 'std::_Tree_nod<_Traits>::_Node *std::_Tree_val<_Traits>::_Buynode<_Ty>(_Valty &&)' being compiled
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>,
1>              _Ty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>,
1>              _Valty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(364) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2> std::_Tree<_Traits>::insert<_Ty>(_Valty &&)' being compiled
1>          with
1>          [
1>              _Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>>>,
1>              _Ty2=bool,
1>              _Traits=std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>,
1>              _Ty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>,
1>              _Valty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1>          ]
1>          c:\users\steve\projects\cimex cad-cam\14.0\cimex application\cimcad\formaddautomaticpage.h(17) : see reference to function template instantiation 'std::_Tree_iterator<_Mytree> std::multimap<_Kty,_Ty>::insert<std::pair<_Ty1,_Ty2>>(_Valty &&)' being compiled
1>          with
1>          [
1>              _Mytree=std::_Tree_val<std::_Tmap_traits<CString,CCimexDataSource *,std::less<CString>,std::allocator<std::pair<const CString,CCimexDataSource *>>,true>>,
1>              _Kty=CString,
1>              _Ty=CCimexDataSource *,
1>              _Ty1=ATL::CStringT<char,StrTraitMFC<char>>,
1>              _Ty2=const CCimexDataSource *,
1>              _Valty=std::pair<ATL::CStringT<char,StrTraitMFC<char>>,const CCimexDataSource *>
1>          ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(163): error C2439: 'std::_Pair_base<_Ty1,_Ty2>::second' : member could not be initialized
1>          with
1>          [
1>              _Ty1=const CString,
1>              _Ty2=CCimexDataSource *
1>          ]
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(167) : see declaration of 'std::_Pair_base<_Ty1,_Ty2>::second'
1>          with
1>          [
1>              _Ty1=const CString,
1>              _Ty2=CCimexDataSource *
1>          ]

Note: the above appears to be a change in how std::set<> works, such that they always give back const_iterators instead of iterators(1). But the point is just to have an example of how much more convoluted the compiler diagnostics are compared to 2008.


So, my question: for any c++ shops out there that have converted recently: do you regret the conversion, or appreciate it? How so?

(1) Scott Meyer's "Effective STL", (c) 2001, p95, item 22.

I just ran into this: it covers many of the code-breaking changes I've been running into: http://blogs.msdn.com/b/vcblog/archive/2009/05/25/stl-breaking-changes-in-visual-studio-2010-beta-1.aspx?wa=wsignin1.0


To answer your first question: Type of &(*it) is probably const CCimexDataSource *, and not CCimexDataSource *.

To give input on your second discussion-question: We have converted from VS2008 to VS2010, and it has worked out fine, although VS2010 is slower, it has a bit better intellisense. The conversion wasn't fully automatic, and we had to manually update the vcxproj files afterward.


At work, we moved from VS2005 to VS2010 with no problems. However, I found that on my home computer, I had to turn off many of the Intellisense features in VS2010 as it was eating up so much processing power on my laptop that I could only type out a few characters at a time before having to wait 3 minutes for it to update its database. If you are running on a fairly new machine (Quad-core ~3 GHz with at least 6 GB RAM) on Windows 7, you should have few performance problems. If you (like I am at home), use a Core2 Duo with 2 GB RAM on XP, you'll find that you have to turn off many features for the IDE to be useful.

NOTE: VS2008 ran wonderfully on my laptop; I was rather disappointed when I "upgraded".


I have no problem on my home PC (Core2Duo E6600, 2 GB RAM) with intellisense. The only thing i don't like is the responsiveness of the UI. It's very sluggish.

I believe the improvements in TR1 and C++0x outweight the drawbacks of the slow UI.


I tried converting our solution (VS2005) with 100 projects and after all the failures to update the project files I decided to give up for the time being as I couldn't even get it to start compiling.

Using VS2010 for new .net projects I find the IDE tries to be a bit more like Eclipse, but it keeps doing dopey things like opening code files in the view portion I last clicked on - say the output or watch variables windows.

Every so often I have trouble with the MS symbol servers, the debug/module feature to specifically go to the MS symbol server seems to get around this somehow and saves time messing with the symbol server list.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号