Live data from Hacker News

It's time to halt starting any new projects in C/C++

twitter.com

721–730 of 929 posts

Re: It's time to halt starting any new projects in C/C++

#721

Unless he means that Rust should be used on projects where the Rust compiler is available for all relevant platforms and C and C++ can be used otherwise, I disagree. In fact, until LLVM is replaced, C++ will probably be the language of choice for new languages. Even `rustc` requires a C++ bootstrap for that purpose. There are also other important C++ and C libraries that will continue to mean C and C++ may be better…

> Oh, and it's possible to make C as good as Rust: I've got macros to do automatic bounds checking.

The really tricky macro though comes when you want to check races in shared mutable state...

Re: It's time to halt starting any new projects in C/C++

#722
post #602

I'm just a programmer who's been doing this for 20 years. I don't have the credentials of Mark, who is a legend. But I fully agree with him. There will be specific exceptions, but if you have the choice between Rust and C++ you would be making a big mistake to not choose Rust. The language is simpler, cleaner, safer, and more enjoyable to work with. The build tools are far more pleasant. The IDE experience is compara…

> Programmers currently using Rust are superior to programmers using C++ > People learn C++ in college. People learn Rust because they love their craft Wow... and rust programmers wonder why rust has a stigma? So I guess John Carmack is inferior and is not an ultimate craftsman.

I think I hit a nerve with this one. If you put out a job ad for any mainstream language (Java, JavaScript, C++, among others) you're inundated by applicants who have no business even working in this industry. If you put an esoteric language like Elixir or Rust, you get a smaller but much higher quality pool of applicants. That's my personal experience, I don't have hard data to back it up. Paul Graham once wrote about this effect in his Great Hackers essay [1].

Of course, the flip side of that is with a smaller pool of applicants, filling the position may not be any easier. It is harder to hire a poor candidate though.

John Carmack has actually played around with Rust. But I would like to reiterate that when generalizing about a population based on statistics, you might be correct more often than you'd be wrong (.e.g. men are more aggressive than women) but you can still easily find individuals who are exceptions. That you can find an exception doesn't disprove the rule. You still have to treat people as individuals, and not as a population. That should go without saying.

[1] http://www.paulgraham.com/gh.html

Re: It's time to halt starting any new projects in C/C++

#723
post #534

Earlier quoted context omitted.

Wut? Makes no sense to me.

Here's an example of C++ code written intentionally with all the latest C++ features: https://gist.github.com/caiorss/c7db87df674326793431a14006aa... It looks pretty much nothing like a C program doing the same job. A lot of those features were made to make C++ a safer language to use. Eg, with a construction like: for(const auto& it : ast){ You can't accidentally walk past the end of the array by going one item too…

> You can't accidentally walk past the end of the array by going one item too far.

AFAIK, that's with a caveat of "unless you modified the array length within the loop" (looking at the gist, "ast" is a deque, so you can pop items from either end); IIRC, that C++ construct evaluates the begin and end only once at the start, instead of every iteration (unlike what you might do with "classic" C++ evaluating "it != ast.end()" every time), so it wouldn't notice the change. This is particularly annoying since C++ developers can be tempted to optimize a classic "for (auto it = ast.begin(); it != ast.end(); ++it)" loop into either the new-style "for (auto it : ast)" or the old-style optimized "auto end = ast.end(); for (auto it = ast.begin(); it != end; ++it)" loop, even though that would break the code if "ast.end()" ever changes within the loop.

(Since the initial discussion is actually about C and C++ versus Rust: in Rust, you wouldn't be able to modify the array within the loop, since the iterator is borrowing it, so this issue would be caught by the compiler.)

Re: It's time to halt starting any new projects in C/C++

#724
Completely agree. And this isn't even controversial. The controversy is about whether to make rewrites, including it in the Linux Kernel and so forth.

But for greenfield projects in systems languages? First of all, that niche is tiny. There may be sub-niches where availability of some specialist library makes it harder to use Rust than C++, but I'd argue that if some library or ecosystem is that important, your project isn't completely green field. An Unreal game isn't a greenfield project even if I start now because the Engine is a massive piece of C++ you have to live with.

For anything this niche of "green field enough", I'd go with Rust even if I had a whole team consisting to 100% of experienced C++ developers. And I wouldn't even sweat the decision.

Re: It's time to halt starting any new projects in C/C++

#725
I still use Lazarus/Pascal, not as clumsy or random as pointer math, an elegant language, for a more civilized age.

Wirth was wise to do everything possible to discourage pointer use, and make it obvious. Hejlsberg and company gave Pascal a worthy library and IDE. Then the language florished under the Turbo Pascal, and later Delphi banner.

But then Hejlsberg turned to the dark side, and joined with the MicroSith. They bought forth Sith.NET, Sith# and all other manner of evil.

Re: It's time to halt starting any new projects in C/C++

#726
post #690
post #517

Earlier quoted context omitted.

What's wrong with .cpp extension?

Speaking of which, why do .cc and .cpp exist to refer to C++ source files? Two compiler vendors that couldn't agree?

It's worse. Others include .cxx (fairly common) and .C (thankfully rare).

Re: It's time to halt starting any new projects in C/C++

#727
post #690
post #517

Earlier quoted context omitted.

What's wrong with .cpp extension?

Speaking of which, why do .cc and .cpp exist to refer to C++ source files? Two compiler vendors that couldn't agree?

You forgot .C (yes, uppercase C means C++, lowercase c means C), .c++ (the best one IMO), and .cxx (when your filesystem doesn't accept crosses, you tip them over). See https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Invoking-G_002... for the full list.

Re: It's time to halt starting any new projects in C/C++

#728

I'm just a programmer who's been doing this for 20 years. I don't have the credentials of Mark, who is a legend. But I fully agree with him. There will be specific exceptions, but if you have the choice between Rust and C++ you would be making a big mistake to not choose Rust. The language is simpler, cleaner, safer, and more enjoyable to work with. The build tools are far more pleasant. The IDE experience is compara…

And sometimes people who love their craft pick the wrong tool (their favorite) for the job, write really shitty code and are hyper-defensive about it, regardless of the language.

I want people who have a history of picking the right tool for the job, and see their job as a team sport instead of a personal art project. Not a hiring manager, but I'd be more interested why someone with knowledge of Rust picked Rust over other options. Mere knowledge of it implies nothing of substance, and I've cleaned up too many mistakes in my career written by people who put their craft ahead of their mission.

Re: It's time to halt starting any new projects in C/C++

#729
post #700

I'm just a programmer who's been doing this for 20 years. I don't have the credentials of Mark, who is a legend. But I fully agree with him. There will be specific exceptions, but if you have the choice between Rust and C++ you would be making a big mistake to not choose Rust. The language is simpler, cleaner, safer, and more enjoyable to work with. The build tools are far more pleasant. The IDE experience is compara…

As someone that is looking to learn one or the other (and hopefully be able to utilize it to land a job too), is the recommendation to skip learning C++ at this point and learn Rust instead? I was going to learn how to write a game boy emulator, which could be written in either, but I’d also like the language to help me in the professional world as someone getting ready to enter the field.

You'll have a harder time finding work, as there aren't a lot of Rust jobs. That's why it's a signal that a person loves their craft - there's little financial incentive in learning it. When it comes to finding work, pick a mainstream language. This will change over time as Rust becomes mainstream, which I think is likely.

Re: It's time to halt starting any new projects in C/C++

#730
post #692

Earlier quoted context omitted.

It's a meme template. The gp post didn't spend time to actually complete it, which is disappointing because it could be very funny.

Neither did you, so now we know a partial joke which could be funny but no one cared to elaborate.

You got me. I actually was thinking about what could go in it, but this is one template that actually takes work to do, so of course I didn't actually finish it.
Post reply on HN