Live data from Hacker News

C++11 Makes Competitors Go Rusty

nerds-central.blogspot.com

21–30 of 69 posts

Re: C++11 Makes Competitors Go Rusty

#21

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.

Is it just me, or could the author know only Go and Rust from their Wikipedia entries?

Re: C++11 Makes Competitors Go Rusty

#22
post #11

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. 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…

> Having to do the #ifndef/#define/#endif dance in every header file I write I'm just using "#pragma once" in my current hobby C++ project. I understand pragmas are living in sin, but is there any reason I shouldn't use them?

Not really anymore, it's supported on most compilers these days. But that's only been the case as of pretty recent.

The same could probably not be said if you were writing C instead of C++.

Re: C++11 Makes Competitors Go Rusty

#24
So, just to fan the flames a bit...

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.

His complaint (read:strawman) about interoperability and performance is really misleading. His 'Compatibility' section is not unfair, but all of those problems are faced by programmers dealing with system libraries anyways. Tell me more about the C++ bindings to C libraries and how they are never used in production.

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.

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.

(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.)

EDIT: Found this, same author I think ( http://nerds-central.blogspot.com/2012/01/sql-failed-experim... ). SQL is a distraction--quick, somebody warn Oracle that they'll be out of business!

Maybe the poor person is just getting lonely in that ivory tower?

Re: C++11 Makes Competitors Go Rusty

#25

A couple of nitpicks: C++/Tr1 has also solved many of the same problems without needing a new compiler 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. My other nitpick…

I wonder if you are confusing TR1 (which came out several years ago), and C++11.

TR1 was designed to not need compiler extensions (although some parts of type_traits, that AFAIK no-one ever used in the TR1 days, could be improved with compiler support). TR1 added regex and tuple among others. It certainly didn't have rvalue references.

C++11 is the new big standard, which certainly requires large amounts of compiler support.

Re: C++11 Makes Competitors Go Rusty

#26
post #11

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. 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…

> Having to do the #ifndef/#define/#endif dance in every header file I write I'm just using "#pragma once" in my current hobby C++ project. I understand pragmas are living in sin, but is there any reason I shouldn't use them?

#pragma once aside, I agree that not having to worry about writing and including headers at all is a significant improvement of Go over C++.

Re: C++11 Makes Competitors Go Rusty

#27
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'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.

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... 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.

Build: ... #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).

Debugging: ... 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)

Team Training: ... 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)

Team Embedded Knowledge: ... This is a valid point. I don't think it's worth the price you pay for using C++...

[Ecosystem complaints - tooling, licensing, lifespan] 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.

Startup And Shut-down Sub-Systems: ... 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.

Paradigm Contamination: ... 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.

Brain Strain (the bilingual problem): ... 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.

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. 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.

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.

As a finishing note, one of my favorite articles on the subject of complexity in programming: http://www.joelonsoftware.com/items/2009/09/23.html

Re: C++11 Makes Competitors Go Rusty

#28

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'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…

[deleted]

Re: C++11 Makes Competitors Go Rusty

#29

How many people here who complain about the language being too complicated have actually been harmed 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 g…

> have actually been harmed by the presence of features in the language

I am harmed routinely by too many features. I've been coding C++ for 11 years and I still end up scratching my head when I end up in foreign territory. Even his code at the end of the article which I think is supposed to be illustrating some kind of simplicity looks like a giant hairball of mess to me. I've ended up devolving to using a small subset of C++ features in my code which I know inside out and is sufficient for my needs. Others all seem to do the same but they arrive at a different subset. Java on the other hand seems to be so feature deprived and simplistic (minus generics, but they are almost an anti-feature) that no matter whose code I look at it is extremely obvious what is going on.

Re: C++11 Makes Competitors Go Rusty

#30
post #19
post #14

I (shrug) enjoy programming in C++11 and like many concepts in it. 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 a language feature and support for pattern matching, etc... While I like support for atomics, memory model, etc.. in C++11, concurrency is still a library in C++.…

I'd like to note that rust does allow mutable shared state, but just in an "unsafe" context, since it is in fact, unsafe.

Rust has typeclasses as well.
Post reply on HN