by ayberk · 4y ago · 0 comments
I love how Eric Raymond describes it as "anti-compact", because, well, it really is. C++ as a whole should be deprecated -- and no new projects should use C++ (unless for some very odd and specific reason).
And what can be used instead of C++? C? If C was better, then C++ wouldn't have been invented. Rust? It's much more painful to use than C++. Zig? It's immature and has very low usage. Nim? Has very low user base. Julia? It isn't solving the same problems.
When cfront turned up, the first versions basically automated that suckage. C++ did get better, but it was still horrible compared to CLOS or Smalltalk. This was largely due to weirdness in how the constructor/destructor ordering worked, the giant bogosity that is multiple inheritance and a few massive other undefined behaviours that every compiler did differently, but I think at this point it's fair to point out the language is bad and things like C# are so much better it's not even funny any more.
C# is much better but still it isn't a systems programming language due to garbage collection. So while you can solve some classes of problems easier and better, it can't replace all of C++ use cases.
Writing compilers, linkers, running bare metal on embedded hardware are all systems programming tasks.
https://twitter.com/markrussinovich/status/15719951172335042...
Learning C++ is like cycling from SF to LA. It starts easy enough and every day you’re making a lot of satisfying progress. But you have so far to go because of all the features and quirks of the language.
It’s probably easier to get started learning C++. But it’s also much faster to finish learning rust and be able to read almost all rust code. (Pin still scares me though)
As someone who has used C++ professionally for two decades, I disagree. Rust's pain is superficial and all up front. C++ pain is death by a thousand paper cuts, especially if you have people on your team that aren't intimately familiar with its pitfalls and its more modern constructs. I don't plan to write a new C++ project ever again, unless there's some very compelling reason to do so. Rust is an absolute breath of fresh air.
For most use cases Java is a better option. Very fast, without any of the pain.
If you truly must not have a VM (rare), there's still C. Perhaps rust.
My rule is that languages are good if they have value types, which explains why PHP is good.
Those are quite different domains, with only minimal overlap.
Embedded systems more often that not are not seeking maximum performance. What matters is smaller code size and running on mimimal hardware. Java doesn't do so well there since you have the overhead of the VM. Java is rarely a sensible choice for embedded code. Just use simple C, or rust if it works for the use case.
(Yes I know project green was originally about embedded set-top boxes! But times changed.)
Performance critical systems are usually large servers for either high througput (web or other server traffic) or low latency (HFT) applications. The opposite end of the spectrum from embedded. That's where Java shines. You might be able to beat Java with carefully hand-tuned C++ but just as likely the JIT might beat you. So for maximum performance server code combined with a more sane developer productivity, Java cannot be beat.
Unless you're doing something really highly specific to C++ (like Cuda for instance or deep integration with big C++ codebase), saying that rust is painful compared to C++ is laughable.
Write a sufficiently complex memory safe program in C++. I dare you. It's been proven again and again that humans can't do it. And calling Rust more painful than C++ is just absurd.
That is totally easy.
What's not so easy, necessarily, is complex numerically safe program in C++ (that performs well).
You appear to have fallen for the Rust hype machine.
We do know many people at Google can't.
It's quite a bit easier than Rust and no other popular language has its most important features (cross platform, interfaces with syscalls and other libraries easily, manual memory management possible, likely to be supported for a long time).
These things are useful in many situations.
I come from functional programming background, so I'm all for taking a little bit longer to make my code compile if that means it'll work. I'd rather deal with compilation errors than waking up at 2am to debug a stupid segfault.
this is not true anymore 90% of the time if you code with a decent knowledge... if you code C, then yes.
FTFY!
Too bold statement. There are still lots of reasons to keep using C++. LOTS.
There are lots. It is just that some ppl think real world is just like when they sit down to code a zero-dep, no time-pressure thing.
It is, among worse things, damned rude.
As such, it is in violation of site terms and conditions, and damned rude.
You are not your job, and prepare yourself for listening to honest criticism of the things you base your identity around or you will find it very difficult to learn and grow.
What was rude and, frankly, hateful, was the call to demote or lay off all C++ programmers.
Funny thing is I'm a C++ programmer myself right now as I mentioned :) Even if we decide to "deprecate" C++ today, Google alone would have large enough C++ codebase left to maintain for the next two generation of programmers.
So no, I don't think it means we should demote or fire all C++ programmers -- but at the same time I'd like to note that as a programmer no one should be married to a single language -- languages come and go.