TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C++11 Makes Competitors Go Rusty

64 pointsby NerdsCentralover 13 years ago

18 comments

jerfover 13 years ago
Your freaking enormous ball of mud accreted some more mud. <i>Quelle surprise</i>. It's probably doing it by sheer gravitational attraction at this point. I do not think that removes the need for languages that have the capabilities of C++, yet aren't freaking enormous balls of mud.<p>The reader may mentally replace my use of the word "freaking" with other choice terms at his or her discretion.
评论 #3540612 未加载
评论 #3540627 未加载
strlenover 13 years ago
I (shrug) enjoy programming in C++11 and like many concepts in it.<p>However, there are concepts in Go and Rust that are salient and stand on their own: typeclasses in Go and Rust (concepts, unfortunately, were left out of C++11), rust making std::unique_ptr&#60;&#62; a language feature and support for pattern matching, etc...<p>While I like support for atomics, memory model, etc.. in C++11, concurrency is still a library in C++. Go and Rust take different approaches to concurrency, but they do make it a _language_ feature which is substantially different.<p>In short, I hate to bible-thump Paul Graham's article, but this article does remind me of the "blub paradox".<p>tl;dr I like C++11, but I am glad there are other options (most importantly, Go, and Rust) being developed for userland systems programming.
评论 #3540182 未加载
angersockover 13 years ago
So, just to fan the flames a bit...<p>About half of his points are general gripes about software development, regardless of language(s): license infections, learning new languages, writing languages with the wrong idioms, runtime versioning issues, wah wah wah this all reads like somebody throwing up arguments just to try and distract readers.<p>His complaint (read:strawman) about interoperability and performance is really misleading. His 'Compatibility' section is not unfair, <i>but all of those problems are faced by programmers dealing with system libraries anyways</i>. Tell me more about the C++ bindings to C libraries and how they are never used in production.<p>His complaint about 'Performance' is similar FUD. Jesus, dude--if you agree on a calling convention, I can probably get my Brainfuck program to compile and interop with your C library. The computer really doesn't give two shits what language caused the stack pointer to move--it doesn't matter. This isn't a valid complaint.<p>His lambda is dumb. He didn't do anything there that couldn't have been done with a function pointer, C-style. If he was trying to show why C++11 lambdas are cool, he failed.<p>(and his code looked like garbage, as others here have mentioned... elegant my ass. No comments, ugly use of operators, namespacing--beautiful C++ this ain't.)<p>EDIT: Found this, same author I think ( <a href="http://nerds-central.blogspot.com/2012/01/sql-failed-experiment.html" rel="nofollow">http://nerds-central.blogspot.com/2012/01/sql-failed-experim...</a> ). SQL is a distraction--quick, somebody warn Oracle that they'll be out of business!<p>Maybe the poor person is just getting lonely in that ivory tower?
mrjover 13 years ago
Ironically his code sample makes me think we need a new language right away.
megaman821over 13 years ago
Of course C++ can do what Go and Rust do, C++ can do everything, but that is the problem with it. C++ tries to do everything and it leaves it not being very good at nearly anything. Also, C++ code-bases are all using different subsets of functionality. It makes becoming a product commiter to a code-base to longer than it should.
ComputerGuruover 13 years ago
A couple of nitpicks:<p><i>C++/Tr1 has also solved many of the same problems without needing a new compiler</i><p>Not true. While many of the boost/tr1/c++0x features are introduced via new headers, there are many compiler-level changes, and that's why you need to use the latest versions of clang/g++/msvc/icc to take advantage of them. Things like r-value references just can't be done without a "new" compiler.<p>My other nitpick is his code sample: I've been write C++ for <i>years</i> but I must say his code sample made my eyes bleed. It's rather far from being demonstrative proof that C++ is elegant and need not be replaced. He should have just imported all the namespaces and been done with it, for starters, in this trivial sample.
评论 #3540267 未加载
scott_sover 13 years ago
I like and use C++. It fits my requirements of allowing high performance but still having rich abstractions. I also like most of the additions in C++11, and I look forward to using them.<p>But, there is a valid argument for using a newer language that has nothing to do with the language itself: the ancient include, compile and link process. Having to do the #ifndef/#define/#endif dance in every header file I write is a reminder of this fact. That hack exists because 40 years ago, there was no concept of package management. I feel the same way when I get linker errors that require me to unmangle my class names to figure out what's visible where.
评论 #3540165 未加载
评论 #3540645 未加载
slavakover 13 years ago
I find the concept of a C++ programmer using the ABI as a bullet-point <i>against</i> switching to a different language highly ironic.
shenbergover 13 years ago
<i>Compatibility: The new language will have to talk with older languages. Types will have to be translated; memory models will need to be aligned and compilers will need to 'play nice' together. This is not just as the compiled object level but at the ABI level during linking etc.</i> I've spent more time solving issues with memory models in C++ than I have in any other language because C++ has no ABI - I've had patches to MSVC change the memory layout of objects and cause breakage which is just as bad as you get with any sort of language interop scenario.<p><i>Performance: This new language is super fast. Great, but it will have to work with existing systems. The interface between the two will slow stuff down a lot...</i> Seeing as C++ has no ABI, there's no non-hacky way to provide a C++ binary shared library that doesn't end up using a very small subset of C++ (for example, no STL, since it's all templated, meaning the code your compiler generates won't interoperate with the code the client's compiler), which means people end up wrapping their C++ code with C APIs.<p><i>Build: ... </i> #include is a broken piece of legacy that everyone will be happy to see disappear - give us real modules instead of a compilation model which pastes file contents inside other files. Also, C++ compile times are ridiculously long compared to a modern CFG-based language (that's disregarding the fact that compilers often disagree as to what's valid code because of the extremely complicated syntax of the language).<p><i>Debugging: ...</i> Debugging modern code that uses shared_ptr, bind, etc. is such a massive pain in the ass because you end up mixing the code you care about with those plumbing details - "step into " becomes useless. Add the fact that there is no ABI and you find yourself unable to introspect objects at runtime when compiled in release mode (where all the nasty memory issues tend to show up)<p><i>Team Training: ... </i> C++ is, as I've been ranting, complicated. I've been using it for a long time, and there's still no language in which I fear making subtle mistakes that'll cause hard-to-diagnose bugs (for example, exceptions are often treated as an anti-pattern because it's so hard not to make such mistakes using them)<p><i>Team Embedded Knowledge: ...</i> This is a valid point. I don't think it's worth the price you pay for using C++...<p><i>[Ecosystem complaints - tooling, licensing, lifespan]</i> Beyond the fact that tooling for managed languages is often superior to C++ (because of the better-controlled memory layout and execution model), these are valid points.<p><i>Startup And Shut-down Sub-Systems: ...</i> This is also broken in C++ - in what order are static objects initialized (definition order inside a cpp file, file sequences are random)? What happens if one wants to refer to another? I know these are solvable issues, but every single one of them requires thought and effort on the programmer's side, and these aren't the sort of issues that a programmer should be wasting his time on.<p><i>Paradigm Contamination: ...</i> Yes, writing in a language and writing idiomatically in a language are two different things, but modern, idiomatic C++ is both something I've seen few people who know (compared to out-dated and dangerous practices), and it still requires more effort to keep in mind than, say, writing idiomatic python, or C#, or java.<p><i>Brain Strain (the bilingual problem): ...</i> This isn't really an argument - it's speculation. I could say that perhaps the fact that C++ is so varied that different subsets of it end up looking like different languages, and all of them with more details you have to keep in mind to make sure you aren't breaking stuff subtly. Also, being bilingual also provides cognitive advantages, so even that flawed analogy might not be proving the point.<p><i>Let us think about the big ideas behind Go: [snip] Well, one can write simple clean C++ and use share_ptr. Just because C++ can be super complex does not mean it has to be.</i> Unless, say, you're writing a DLL (another fun fact: not only can your API not have STL, exceptions also can't cross DLL boundaries), or you're using DLLs written by other poor souls who were consigned to writing DLLs with a C++ API.<p>This is not to say that C++ has no place in software development (I use it daily at work), but I'm of the opinion that unless you have a really good reason, avoid it like the plague. New languages taking over more niches C++ used to occupy is a good trend.<p>As a finishing note, one of my favorite articles on the subject of complexity in programming: <a href="http://www.joelonsoftware.com/items/2009/09/23.html" rel="nofollow">http://www.joelonsoftware.com/items/2009/09/23.html</a>
评论 #3540845 未加载
评论 #3540366 未加载
jchonphoenixover 13 years ago
Sure C++ can do what Go and Rust do. In fact any language that is turing complete can do anything that any other turing complete language can do. It just matters how easy to do it and how the syntax is. It's all about warts, and C++ has a lot of them.
评论 #3540223 未加载
评论 #3540632 未加载
0x0over 13 years ago
<i>Let us think about the big ideas behind Go: It is simple, clean and has garbage collection.</i><p>That's quite a bit of an oversimplification. Goroutines and channels are two big ideas in Go, and the author pretty much ignored those completely.
ori_bover 13 years ago
As soon as he said <i>"both Google and Mozilla have been playing the 'new object oriented native language' game recently"</i>, I stopped reading.<p>If you aren't sufficiently familiar with either language to know that neither of them is particularly object oriented, at least in the traditional sense, then you probably shouldn't be writing about them.
评论 #3540701 未加载
mrichover 13 years ago
C++ is great if used with care, the problem is that it has too many features and many things are quite braindead. Features are hardly ever removed (I like the Python approach better) But for complex, high performance applications it is still the best choice.
SamReidHughesover 13 years ago
How many people here who complain about the language being too complicated have actually been <i>harmed</i> by the presence of features in the language? If you want an advanced programming language, it's going to be complicated. Without garbage collection, it will be even more complicated. Almost every feature that exists in C++ exists for a reason, and every one that was added or removed in C++11 was added or removed for good reasons.<p>If you want a less complicated language than C++11, other than some low-hanging white noise inherited from C, you'll probably have to give up safety, convenience, performance, or exceptions.
评论 #3540445 未加载
评论 #3540579 未加载
评论 #3540559 未加载
评论 #3540119 未加载
评论 #3540708 未加载
16sover 13 years ago
I do systems programming and I use C++ a lot. It's perfect for that. Anyone who does systems or embedded stuff will tell you how wonderful C++ is over the alternatives.
Mavrikover 13 years ago
I hate to be "that guy", but for someones sake, fix the site on ipads. Not only it tells you you're using an incompatibble browser (a blast from IE past), then it swirtches to iPad specific (????) non-zoomable fixed layout, which makes it pain to read.<p>Really, how can a tech person think this is a good idea of publishing content? Please fix it.
akkartikover 13 years ago
It all boils down to whether you're starting a new project/binary. If you are, go with the new and leave all the backwards-compatible crap behind. If you aren't, then this article will speak to you. I also wouldn't want to be in your shoes.
drivebyacct2over 13 years ago
I have fun when I write code with Go. I love the syntax, type inference and standard libraries. I wrote a transcoding video http server with html frontend in like a hundred lines of code and it doesn't make my eyes bleed. I don't think Go needs to replace C++ but I certainly <i>prefer</i> it. I think there are tons of uses for C++ still obviously (least of which is Go's GC-nature), but I don't think C++11 makes redundant the space that Go can occupy.<p>I know it's personal preference (but frankly, so is the article's position) but that C++11 code looks terrifying to me, I'm still guessing at what several of the pieces of code do. A python programmer looked at my go-code and very easily deduced what it was doing and made good suggestions immediately.<p>edit: s/VM/GC
评论 #3539907 未加载
评论 #3548394 未加载
评论 #3540754 未加载