TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

C++98 Support Costs Extra (or why we should switch to C++11 now)

34 点作者 zeugma超过 13 年前

10 条评论

HardyLeung超过 13 年前
I used C++ for years, and then switched to C#, and recently switched back to C++ in my new company (choice of language reflects only the nature of the software we develop, not language superiority). Just yesterday I was evaluating the new features of C++11, and I was pleasantly surprised by (1) the new language features, and (2) the extent of support already by existing compilers (gcc 4.4 and VC++ 2010).<p>I can see that we'll immediately benefit from a few improvements, such as auto variable, lambda support, standard support for unique/shared/weak_ptr. Even old school C++ users who have no interest in fancy new idioms would benefit from these "syntactic sugar" features found in other modern languages. There are a lot more that I'm still exploring, but so far I like what I saw.<p>Also these new features just work on the compilers. Given how long the standard process has been, a lot of the features were already baked in. Modern g++ and VC++2010 both have very good support. I listened to a BUILD presentation on C++ and the Microsoft folks are very committed to full C++11 compliance in VS11 (next version of Visual Studio), but AFAIK, VS2010 is already quite capable.<p>So, I agree, if you have a choice, switch NOW.
colomon超过 13 年前
And in the (rather depressing) real world, I have gotten flack in the past year for making changes to my source code that required C++98 compatibility, which made said code no longer compile on Microsoft Visual Studio 6.0.
评论 #3022281 未加载
p9idf超过 13 年前
"How many Mac applications still support OS X 10.2? 10.3? 10.4? Half of the web doesn’t work anymore on KDE 3.5′s Konqueror."<p>I'm not familiar with the author's product and can't say whether C++11 is the right choice for him, but I wouldn't consider the constant API churn of OS X or the constant web standard and web standard extension churn to be a good argument in favor of anything.
评论 #3022571 未加载
calloc超过 13 年前
GCC, Clang, Visual C++ 11 provide charts where they show how far they have completed c++0x support (renamed to c++11):<p>GCC: <a href="http://gcc.gnu.org/projects/cxx0x.html" rel="nofollow">http://gcc.gnu.org/projects/cxx0x.html</a><p>Clang: <a href="http://clang.llvm.org/cxx_status.html" rel="nofollow">http://clang.llvm.org/cxx_status.html</a><p>Visual C++: <a href="http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx" rel="nofollow">http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.a...</a>
评论 #3023159 未加载
xsmasher超过 13 年前
This is analogous to the "let's drop IE6!" movements. If your client doesn't need backward compatibility, great for you. If they do, then good luck charging them for a new version that's <i>worse</i> (no longer works/compiles) in their environment.
iam超过 13 年前
I want to completely agree with this guy, I really do. But Visual Studio 2010 supported more of C++11 then most other major compilers (except I think for Comeau and GCC) when it was released.<p>Apple didn't choose Clang over GCC for political reasons, a lot of Clang devs are actually on the Apple payroll.. and Clang is just a far superior compiler to GCC architecture-wise -- it just needs a few more years to catch up to full C++11 support.<p>The fact of the matter is that unless you're starting a new project you're probably tied to your old version of the compiler, to upgrade to something newer would require weeks of updating the toolchain.
评论 #3024691 未加载
blub超过 13 年前
C++11 would be nice, but I think it will be a while before I can use it. I don't think any of the mobile platforms support it...<p>I am now using GCC 4.4 and haven't used MSVC in a while.
Animus7超过 13 年前
Our company's been C++0x-heavy since the first bits rolled out in GCC. We're lucky enough not to have any legacy, so we can afford this.<p>The other day I was stuck on a system with only a C++ (03) compiler, and it was a truly crippling experience without lambdas and the new STL.<p>Anecdotes aren't worth much, sure, but I find it difficult to disagree with this article.
angersock超过 13 年前
Some entertaining bits from the article:<p>"How many Mac applications still support OS X 10.2? 10.3? 10.4?"<p>"Then why should we be so conservative when it comes to C++, the very core of what we work with?"<p>"C++11 is a much more productive language than C++98. We as an industry can, however, only reap that productivity gain if we stop throwing C++ productivity out of the window by the bucket-load in the hopeless pursuit of compatibility with non-standard implementations."<p>I'm as much for iconoclasm as the next person, but this whole C++ madness is starting to make me worry. While the rest of us have been off in the trenches of maintenance and production, some cabal of academics and chuckleheads has been cooking up this monstrosity of a language, and now it is finally coming to a head.<p>Folks, conservatism in software design is appreciated--in language design, essential. Python 3 is still not support by many useful libraries. Perl 5, over ten years later, is still in production and use. ECMA/Javascript is only now really taking off, after 15 years.<p>And on the darker, even more depressing side of things, you've still F77 codes in "production" and <i>active maintenance</i>--a friend of mine who is a graduate student is dealing with this right now. These are souls being fed to the gaping maw of legacy code.<p>I'm sure C++ has some interesting features. I understand, for example, why the "auto" keyword is being given new meaning (because the syntax of the STL, classes, and templates is so mindnumbingly awful!). I understand why explicit defaulting and deleting of function might lead to cleaner code (regardless of, say, an explicit that already exists). I understand why I might want 3 different declensions of 'u' in front of a string to support various forms of Unicode (where is your liberalism about forcing everyone to using UTF-8 and being done with it?).<p>I also understand that D probably has a better execution on these ideas than C++.<p>And that Javascript and C# have a better implementation of lambdas and closures.<p>And that for raw power and readability, C with embedded assembly (still!) can probably eat the lunch of any C++. (for an example of rational language evolution, see C1X: <a href="http://www.open-std.org/jtc1/sc22/wg14/" rel="nofollow">http://www.open-std.org/jtc1/sc22/wg14/</a> )<p>And that C++ still doesn't have anything other than a crackheaded set of half-idioms for exporting classes for dynamic linking in a crossplatform way, or even for binding to another language! Go ask the poor bastard who wrote SWIG's comments on the same--he quit programming for several years to stop dealing with C++'s increasing garbage.<p>I feel reasonable in saying this: C++ is not going away soon. One day (even sooner if you are in academic circles and dealing with libraries) we maintenance programmers are going to have to start dealing with code written to take advantage of the new features in C++11.<p>And on that day, all of us will be wondering why the hell we are still using that katamari of language features, instead of something less baroque--perhaps Perl.
评论 #3022493 未加载
cheez超过 13 年前
If your supported platform list looks like this:<p><pre><code> Windows </code></pre> Switch to C++11 NOW. You will kick yourself for not doing it earlier.
评论 #3022733 未加载