I am very confused. Some of these ramblings are just plain wrong, like > But exceptions come at a performance cost. No they don't. An exception that isn't thrown costs nothing. Also > Let’s say I want to know if a constructor failed. I have two options, one is to pass in an in-out parameter, the other is to the throw an exception. Using a factory function instead is a third option that avoids this. Besides, this is a…
Is C++ Doomed?
141–150 of 168 posts
Re: Is C++ Doomed?
#142Everything before that statement is about straight C++98 and C++98 issues: exception safety, should constructors throw and what to do.
Re: Is C++ Doomed?
#143Earlier quoted context omitted.
Have you heard the phrase "death by 1000 cuts"? That's what programming in modern C++ is like. I agree they don't quite make the case for "doom" but it's still not a pretty picture.
This image is mostly painted by people who forgot to stop. By that I mean stop using every feature and detail because it's there. C++ can be used like a much better C (smart pointers, references, const-correctness, generics via templates) and most of the complications can be ignored that way. Premature optimisation is another big factor. If there's no measurable performance bottleneck, things like move-semantics don'…
Re: Is C++ Doomed?
#144Earlier quoted context omitted.
rust is not good for game dev compilation time is even worse than c++ there are hidden allocations EVERYWHERE that you can't even control stop trying to push that narrative, it makes rust look bad rust is nice if you target things like drivers, anything else it's bad the other day i read people who thought rust could replace javascript just take a nap and move on, you are delusional
> compilation time is even worse than c++ That's highly dependent. C++ is pretty bad and I've seen quite a few codebases where the C++ is way worse than the equivalent of Rust. > there are hidden allocations EVERYWHERE that you can't even control That's simply not true. It's also a highly ironic statement given the tendency of C++ to have all manner of allocations all over the place (example--look at how many people…
Re: Is C++ Doomed?
#145Earlier quoted context omitted.
> The author seems to look for something like Go instead But in Go you also have to write exception safe code, something the author complained about. Before someone says "but you're not supposed to throw or catch in Go": the std http server swallows exceptions thrown in handlers, and fmt.Print does for String callbacks too. And before someone says Go doesn't have exceptions: It does, 100%, in all but name. I actually…
> And before someone says Go doesn't have exceptions: It does, 100%, in all but name. But here the name actually matters. They're called "panic"s, not exceptions. When you panic, you signal a fatal error that should ideally terminate the program. You shouldn't care about closing files or freeing memory, because well-written Go does not panic, and if it does, execution will end very soon. A panic in a String() method…
Re: Is C++ Doomed?
#146Earlier quoted context omitted.
Would also be curious to know this. I had heard (anecdotally) that Ada is commonplace in aerospace tech.
I only have limited experience, but I’ve seen projects migrate from Ada to C++ more often than the other way around. If I had to guess why, it’s probably because it’s easier to hire for.
Re: Is C++ Doomed?
#147Earlier quoted context omitted.
The Arduino and friends can run on C++. The Arduino “IDE” uses “C almost ++”, but C++ compilers for AVR and ARM boards do exist.
Certainly you can write C++ for MCUs; the question is, should you, and does the ecosystem encourage that. OTOH a bigger ARM core can very well be found on a small embedded computer, and it's capable enough to run something like a browser. At this scale, pure C becomes burdensome, and libraries (like a browser engine, or Qt) are in C++ anyway.
Re: Is C++ Doomed?
#148Earlier quoted context omitted.
> Using C++ with exceptions disabled is the only foolproof way to run it in a large heterogenous application. Is there a way for a ctor to report failure in newer C++ standards or are exceptions still the only way[1]? [1] https://www.yosefk.com/c++fqa/exceptions.html#fqa-17.2
Exceptions are the only way. You can workaround this by using static factory methods. The herbceptions proposal for “deterministic” exceptions addressed this issue well IMO.
Re: Is C++ Doomed?
#149I agree that C++ is a mess of a design, but I don't think this article quite gets how. RAII and move semantics are two of C++'s best features, and the ones that any replacement - like Rust - will copy. To me, bigger flaws with C++ are that it's too big. The language is bloated with multiple features that accomplish similar things, but each with their own odd corner cases and interference. Anytime there's an issue fro…
From a post in /r/cpp [1], > As of C++20, the right way to write a trivial getter in C++ looks like `[[nodiscard]] constexpr auto GetFoo() const noexcept -> Foo { return foo_; }` C++>11 is such a mess than most useful changes are invisible to most users due to bloat. I think it's way past time to call it quits and abandon active development of the language. New features will come from other languages without 35 years…
Re: Is C++ Doomed?
#150Earlier quoted context omitted.
> compilation time is even worse than c++ That's highly dependent. C++ is pretty bad and I've seen quite a few codebases where the C++ is way worse than the equivalent of Rust. > there are hidden allocations EVERYWHERE that you can't even control That's simply not true. It's also a highly ironic statement given the tendency of C++ to have all manner of allocations all over the place (example--look at how many people…
Rust/WinRT has a ticket where currently it takes 10x times longer to compiler than C++/WinRT.