Hacker News
points by shevy-java 4 days ago | 0 comments
C++ is in a strange position.

If you look at "let's use AI to rewrite xyz in Rust", then C++ has to wonder why it isn't as often mentioned compared to Rust here. I am not saying AI should be the future, but merely compare why Rust is cited here more frequently than C++. That's just one of many other things. Rust also got popular due to crates. How is the alternative called in C++? Barely anyone outside the C++ community knows. And that's also a problem.

C++ isn't going away anytime soon, of course, but when people keep on mentioning alternatives again and again then it shows that the competition intensifed a lot.

[–] jeroenhd 4 days ago
I think Rust's saftey guarantees are an important reason to throw it at LLMs. LLMs make stupid mistakes, even the very best ones, and a lot of them, all the time. Having a compiler reject those mistakes makes for a better automated process. C++ has some safety mechanisms as well, but they're weak and fragile compared to Rust.

For people with C++ experience working together months at a time that doesn't have to be a problem, but AI rewrites turn a million lines of one language into a million of the other in a day, followed by an impossibly short human review.

Rust also isn't as safe and correct as you'd hope it to be for "fuck it, let the LLM deal with it" style programming, but it's got the best speed-usability-safety balance out of the common languages if you don't trust your programmers.

[–] scotty79 4 days ago
Why would anyone want to rewrite anything in C++ given they can choose anything else? Like Rust or Go or C or Zig or literally anything else.
[–] nananana9 4 days ago
I wouldn't choose Rust because of compile times. C++'s aren't great either, but with discipline in how you structure headers, you can get them down to a pretty reasonable place. Unsafe Rust is also a bit of a PITA, and I have cases where I care lot about precisely how memory is laid out and accessed, I'd have to resort to it quite a lot. I don't love crates either, they smell a bit like node_modules and all big Rust projects I've seen have hundreds of them. Most C++ libraries are self contained, by nature of not having an easy way to declare dependencies.

I wouldn't choose Go because GC is a non-starter.

I wouldn't choose C because it's nice to have some form of generics or metaprogramming, even if templates are not exactly fantastic.

I wouldn't choose Zig because the language isn't stable, and the lead developer has hinted that they'll drop LLVM down the line, and I don't want to beta test their compiler backend.

[–] tnodir 4 days ago
Zig drops LLVM for debug mode only.
[–] drnick1 4 days ago
Because, used sensibly, C++ is a better C. This is more or less what C++98 was, and even that is probably too much.
[–] filipdobro 4 days ago
Compiler stuff in MLIR.
[–] thatxliner 4 days ago
> How is the alternative called in C++?

what is it though? vcpkgs/decentralized repositories?

[–] smallstepforman 4 days ago
With package managers on Linux, BSD and Haiku, the only odd man out needing packages is Windows, and vcpkg fills this gap so its no longer an issue.
[–] filipdobro 4 days ago
It is de facto vcpkg
[–] gmueckl 4 days ago
Hacker news has always been a rust bubble. Tallies of opinions voiced here are always skewed in some ways.