Live data from Hacker News

Is C++ Doomed?

tednesday.wordpress.com

11–20 of 168 posts

Re: Is C++ Doomed?

#11
post #8
post #3

Gonna be a long while before safety and certification bodies for industries like aerospace move away from C++. All the tools for the past few decades focus on C++ as the main systems language in these cases. Rust is great as a spiritual successor with more stable performance (in general) but the institutional inertia with C++ is strong.

What's the state of Rust/C++ interop currently? Naively it seems like allowing Rust in C++ projects could be a reasonable way forward, but I haven't tried it personally yet.

C++ doesn't have a well defined ABI. So the interropt between rust and C++ is mostly over a C ABI bridge. For the most part, that's not too painful.

Re: Is C++ Doomed?

#12
post #8
post #3

Gonna be a long while before safety and certification bodies for industries like aerospace move away from C++. All the tools for the past few decades focus on C++ as the main systems language in these cases. Rust is great as a spiritual successor with more stable performance (in general) but the institutional inertia with C++ is strong.

What's the state of Rust/C++ interop currently? Naively it seems like allowing Rust in C++ projects could be a reasonable way forward, but I haven't tried it personally yet.

cxx, the high-level Rust/C++ interoperability layer, is currently used in production at large scale.

Re: Is C++ Doomed?

#14
post #9

The commentary is good, but the conclusion is unsupported. These are annoying issues, but doom they do not make.

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.

Re: Is C++ Doomed?

#15
I should note that writing data structures in rust is also a fraught business! In practice, that’s just a property of languages that don’t have garbage collection.

Exception safety is a serious complication in c++! Exceptions were a mistake in the language, particularly given the existence now of std::optional.

Re: Is C++ Doomed?

#16
post #5

It's true that implementing a standard library in C++ seems daunting but a) most C++ users don't implement stuff that goes into the standard b) you can tailor your data structures to the problem at hand instead of making it usable with every type and use case c) quoting Stroustrup: "There are only two kinds of languages: the ones people complain about and the ones nobody uses".

b is a limitation. C++ makes writing good general code a nightmare so you reduce to taylor your data structures to your problem

c is just folk wisdom. That quote is just untrue

a is true but it has gotten to the point that implementing C++ std libraries and compilers is so daunting a task that even the big vendors do not rush into it anymore. There is this growing fatigue that left only MSVC, gcc and llvm in the game, and even them are always late to the standard

Re: Is C++ Doomed?

#17
The basic problem with C++ is that it has has hiding without safety. C has neither, and most newer languages have both. Attempts to add safety to C++ via templates always seem to leak raw pointers, since many APIs never converted to C++. It's significant that there isn't a C++ Linux kernel API, where you use C++ strings for everything and get rid of the null-terminated stuff.

You see this in the original poster's example. He's doing C-type I/O in C++. Of course it doesn't work cleanly.

It's frustrating. C++ is object-oriented. The cool kids don't like that. So, Rust isn't object-oriented; it uses traits and generics. Those are different enough that there is no one-to-one way to convert modern C++ into safe Rust. It takes a redesign.

So we're kind of stuck.

If you're familiar with game engines, consider what it would take to convert Unreal Engine to Rust.

Re: Is C++ Doomed?

#18

I should note that writing data structures in rust is also a fraught business! In practice, that’s just a property of languages that don’t have garbage collection. Exception safety is a serious complication in c++! Exceptions were a mistake in the language, particularly given the existence now of std::optional.

Finanally, c++ is the only language I would ever want to do linear algebra in, or for that matter, many graph algorithms. Rust is adding features to make it useful for linalg, but it’s not their yet. Linear algebra is important!

Re: Is C++ Doomed?

#20
I dunno if it's doomed or not, but I picked up the language again recently for a project of mine and whenever I look at cppreference.com for any of the newer features I feel like an idiot. Feels like studying for college exams all over again. Smart pointers is as far as I'm gonna go with the post C++03 features, miss me with all the template stuff and compiler tetrises.
Post reply on HN