6 ms·
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 a
by SamReidHughes 15y ago
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 good reasons.
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.
- drivebyacct2 15y agoNo offense, but have you spent much time with Go or Rust? In most cases Go's performance difference isn't extremely divergent from C++'s and it preserves safety and enhances convenience, exceptions and adds concurrency.
- cageface 15y agoLast I heard the Go compiler was generating code 6x or more slower than comparable C++ code. Is that not still true?
- enneff 15y agoYou heard wrong: http://blog.golang.org/2011/06/profiling-go-programs.html http://blog.golang.org/2011/06/profiling-go-programs.html
- andrewcooke 15y agoThe graphviz / svg output from the profiler shown there is very nice. Does something similar exist for other languages? I particularly like the scaling of the node size by the appropriate value (CPU time, memory use, etc).
- enneff 15y agoGo's pprof is based on the C-based one: http://code.google.com/p/gperftools/ http://code.google.com/p/gperftools/
- SamReidHughes 15y agoGo afaict does more than preserve safety, it improves it! And it enhances convenience. Concurrency in C++ works just fine, though.
- zmmmmm 15y ago> 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.
- anonymoushn 15y agoCan I just trade in my exceptions for Maybe or Either? It's already possible to do both of these things, the trouble is that I have to use other people's code that uses exceptions.
- evincarofautumn 15y agoExcept the C++ dragon rears its head. How do you build an intelligent Maybe or Either type in C++? Should they be value types containing unions? You can’t use “non-trivial” types in unions till C++11, and a lot of people haven’t yet upgraded. Referential types with dynamic allocation? How do you transfer ownership? Are “Left” and “Right” subtypes of “Either”? It’s ridiculous.
- SamReidHughes 15y agoThe choices are clear for every situation you describe.
- evincarofautumn 15y agoTo you, to me, but not to most C++ users. Yeah, these types should be in a library, but that’s not the point. A programmer shouldn’t have to be on par with the Boost writers to make something this conceptually simple. I’ve used C++ as my primary language for years and only now can I speak with authority on the finer points of the language. It’s quite powerful, but so unpleasant.
- Jare 15y agoI spent almost as much time learning advanced C++ as I did unlearning it and going back to KISS. Even then, I still had to deal with code from people who were stuck in the advanced stage.
- kaffiene 15y agoI would think that anyone who has coded C++ in teams and/or working with other people's APIs would be instantly familiar with why too many features in the language are harmful. I had an instance where someone overloaded the new operator which confused the hell out of the team (parenthesis overloading caused a similar issue). Another instance was a grad developer 'updating' a system to use templates so that (a) no-one else in the team understood how to use it (b) it (predictably) broke, yielding half a page of compilation errors that no-one including it's author understood and (c) slowed the compilation process down to a crawl. Another instance (repeated in dozens of similar contexts) was sharing code with other teams where we had used C++ as an OO language and they had used it as a procedural / faux-functional language and trying to make these incompatible styles mix. Other cases are pretty much any one of the major C++ systems that tend to work 90% of the time but you need to know why and when they don't. These cases are legion. Programming languages don't have to be complex. C is simple. Java is simple. Lisp is simple. Each of those languages can be pretty damn powerful.