5 ms·
Begs the question: Why C++? Legacy projects (I am not being pejorative, they are important) which must be maintained aside, should not C++ be deprecated? We
by worik 5y ago
Begs the question: Why C++?
Legacy projects (I am not being pejorative, they are important) which must be maintained aside, should not C++ be deprecated?
We have many new languages, we always had C. What does C++ give us in 2022 that makes up for the enormous cognitive load of understanding and keeping up with it.
- usefulcat 5y agoThe ecosystem is frequently more important than the language.
- criddell 5y agoBelieve it or not, there are a lot of us who enjoy C++ and think the language is getting better all the time. IMHO, it's a pretty good time to learn C++. As for what do you get? Well, compared to C you can get higher programmer productivity and compared to any language other than C, you get great performance.
- addaon 5y agoI find that it's not rare to get better performance from C++ than C. As a trivial example, generic container code in C is likely to be run-time generic and sit on memcpy etc; the same functionality in idiomatic C++ is likely to be compile-time generic and be able to use fixed-size copy/move operations instead.
- freedomben 5y agoC++ is still a wonderfully performant language, and there are still domains where it is clearly a leader (networking, games/graphics, etc). Rust is slowly displacing it but there's still a lot of road left. The maturity, stability, prior art are also worth something. The pitfalls are really not that big and dangerous, although to someone who doesn't do C++ I can see why it has that perception. Additionally, if you aren't a functional programming lover (like I've become lately), C++ is one of the funnest languages to work in (as long as the codebase follows could principles). That said while I used to use C++ for nearly everything, these days I use Elixir for app dev whenever I can, and Ruby and bash for scripts. However if I were going to write a desktop app today I'd most likely go for C++ so I could use Qt. I do really need to try out new GTK though, sounds like it's gotten really great.
- ncmncm 5y agoMore people start using C++ professionally in any given week that the sum total paid to code Rust. Rust is not "displacing" C++ anywhere beyond the HN echo chamber.
- lanstin 5y agoWe've talked about Rust in my monthly beering meetings with other programmers, so it's definitely gaining mindshare to some extend. And it's being prepped for Linux kernel inclusion. Once that lands it will be pretty respectable.
- freedomben 5y agoDo many people in the meetings comment about the functional programming feature of rust? That to me is one of the greatest benefits as functional patterns are (at least were) harder in C++ and were definitely less common (which makes code harder for others to understand). In your sample of C++ people, is there much interest in functional programming?
- lanstin 5y agoIn this group, my friends are all former C programmers, not so much C++. I mean one does what one has to. I think I'm the main Lisp fan, and no Haskell or anything (although I went to high school with a guy that loves Haskell and lazy eval and mathematics of infinite sequences made fully instantiated). I think the idea of pure functions being safe in a way state mutating functions are not is deeply appreciated by C programmers. In larger groups, I have never found much appreciation for functional programming, and side-effect free APIs/design philosophies to be particularly popular. Usually there's one smart person that loves it, and they make some systems that are 10x as performant as the standard Java whatever and then no one else gets it and it's rewritten into regular OO Java and the person moves on to a more enlightened job.
- ncmncm 5y agoIn other words, talk. Like on HN. Respectable doesn't mean used.
- physicsguy 5y agoIf you don’t want to use LLVM then you don’t have much choice.
- Koshkin 5y agoThat's not true. GCC, for instance, is a GNU compiler collection. (True, it does not include Rust, the last time I checked.) Other than that, there's always Java, Common Lisp, Haskell, and D. Plenty of choice there.
- physicsguy 5y agoThey're hardly comparable languages are they? If I want to write some embedded software or work on a POWER9/10 machine at work, I'm basically limited to C or C++.
- trinovantes 5y agoI still use C++ for the occasional projects that a quick Python script can't easily solve - I've been using C/C++ since my first year of undergrad so I'm already familiar/comfortable with it - Java has too much boilerplate (my mind is still stuck in Java 8 so maybe things have changed since then) - I found myself spending more time fighting the Rust/Go compiler than actually solving my problems - I don't want to package a web browser for a simple 1-2 UI application
- ska 5y ago> We have many new languages, we always had C. The short answer is probably that (unsurprisingly) C still does not scratch the particular itches that C++ was created for, and non of the new languages hit all of them well either. Plus network effect.
- Koshkin 5y agoLittle things... Destructors; overloading; namespaces; and yes, exceptions. Things I can no longer live without. Generics (templates) are nice to have, too.
- worik 5y agoYou will learn to live without overloading and exceptions. Generics is an absolutely must have. In 1997 I was was giving up on C++ when I discovered the standard template library. I was lucky to be using Visual C++ on Microsoft. The (only) good thing good thing about that compiler is it implemented the STL using Stepinov's reference. Stepanov defined STL in 1994. By 1997 there were SFA implementations that followed the standard. Most "improved" it and made a mess of it, like GCC. (I may have remembered that wrong, mēh) It completely changed the way I thought about computer programming. Before that I was always programming in a style suited to assembly programming
- AnimalMuppet 5y ago> What does C++ give us in 2022 that makes up for the enormous cognitive load of understanding and keeping up with it. If I were starting a greenfield project today, I might choose C++ for it, depending on what it was. (Pick the best tool for the job, and all that.) But if I picked C++, I would not use the full enormity of the entire C++ language specification. I would use the parts that helped with the program I was trying to write, and explicitly not use the rest of it.
- fulafel 5y agoThere are still some environments where security/safety does not matter much and modern alternatives don't target. Like firmware for a RC project, or a non networked or sandboxed platform game where tooling for other languages is missing (like consoles). If you already know C++ and risks down the road very well.