Live data from Hacker News

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

twitter.com

581–590 of 929 posts

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

#581

Speaking of Microsoft, it's time to halt starting any new projects in Windows and use Linux for those scenarios where an OS kernel is required. For the sake of security and reliability. the industry should declare that OS as deprecated.

get back to me when there's equivalents of KPP/Credential Guard/a stable driver API/etc

Do we still have ads in the operating system?

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

#582

Earlier quoted context omitted.

Seriously, just use unsafe. “Welp, can’t write a doubly-linked list in safe Rust so I might as well use C” is throwing the baby, the bathtub, and the rest of the greater metro area out with the bathwater.

Not a rust dev, but shouldn't this be solvable using generics? At least I'm pretty sure I could construct a double linked list with a sane API using only references in C++ with templates. I would have used inheritance to create a "ListBaseType" with a "ListElementType" specialization (with all the data required to wrap some element) and an empty "ListNullType" to use as begin/end elements. A quick Google search resul…

Why would you design a list this way? So many things are wrong here; to name just a few:

1. Pointers work fine, you're not solving any problems here. 2. You can't rebind references in C++, so you wouldn't be able to delete nodes 3. Even with this insane approach, why would you use inheritance over a sum type? 4. Extra allocations or statics are needed to hold sentinels.

As for why this wouldn't work in Rust, in addition to its many general problems, the fundamental issue is aliasing. Rust mandates that if a mutable reference to an object is alive, then nothing else references it. Thus, it would only work if your entire list was immutable; this may fit within your definition of a sane API, but it's not what most people would want if they were choosing to use Rust.

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

#583

Earlier quoted context omitted.

Because, little by little, C++ became "unlearnable". Long ago C++ made C a little bit more complex. Because there were already lots of C programmers that wasn't a big deal. But then it didn't stop. Little by little C++ grew into a monstrosity. A lot of people went along. I gave up. For new programmers to climb in 2-3 years a mountain that seasoned programmers took 15-20 years to climb is asking too much.

In what world is C++ harder to learn than Rust?

Cargo is the number one feature of Rust that makes it easier for a newbie to use. New users of C++ struggle the most with building and linking projects together. Cargo makes that newbie proof. Source: I teach C++ and Rust to new programmers, and they almost universally get further, faster with Rust than C++.

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

#584

Earlier quoted context omitted.

I'd pick Rust over "modern" C++ just because I don't have to deal with 15 compilers, 15 IDEs, 15 build systems, decades of language experiments, kind of compiler-flags driven development

The true real win of Rust. Knowing that you are incredibly likely to be able to compile it without any hoops. Random C/C++ project can still be a roll of the dice.

> you are incredibly likely to be able to compile it without any hoops

Nice.

Does that hold true for cross compiling to arm (Rpi specifically) and Android?

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

#585

Earlier quoted context omitted.

People who use permissive licenses usually don't care about the license-inclusion clause, so most people just don't bother with it until someone comes asking. At the end of the day, fixing that problem is just a matter of including a new text file in the next release. It's nowhere near as big of a deal as when someone complains that you're not complying with the GPL. By the way, whether you're linking statically or d…

I disagree with both paragraphs. By choosing a license that requires attribution, developers are communicating a preference. MIT0 and 0BSD exist. If someone does not care about attribution, they would use one of those licenses. Dynamically linking to a MIT lib is not the same as distributing an MIT lib, so yeah static linking to the lib is completely different, according to the terms of the license. If you are workin…

They certainly don't care enough to enforce it.

>Dynamically linking to a MIT lib is not the same as distributing an MIT lib

Would you mind citing the clause that makes that distinction?

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

#586

Earlier quoted context omitted.

In what world is C++ harder to learn than Rust?

Cargo is the number one feature of Rust that makes it easier for a newbie to use. New users of C++ struggle the most with building and linking projects together. Cargo makes that newbie proof. Source: I teach C++ and Rust to new programmers, and they almost universally get further, faster with Rust than C++.

I concede that the Rust tooling is miles ahead no question.

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

#587

Earlier quoted context omitted.

He doesn’t need to be fluent in every language to set technical direction as a CTO. You don’t question a general’s war strategy simply because they aren’t accurate with a rifle.

If you're commanding officer orders a bayonet charge in the late 19th century it is safe to say they don't understand the change rifles have brought to the fight. Reference Picket's charge.

I was saying a commanders accuracy with a rifle isn’t relevant to their ability to decide tactics or strategy.

Nothing you’ve said contradicts what I said.

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

#588
post #211

I tried Rust about five years ago and I had trouble expressing cyclic data structures because there is no clear "owner" in a cyclic data structure. The "safe" solution recommended by the rustaceans was to use integers as references to the data in a vec or hashmap. I was rather put off by this: Instead of juggling pointers I was juggling integers. It made the code harder to debug and find logic errors. At least when I…

I ran into the exact same problem and wrote up some potential solutions at https://eli.thegreenplace.net/2021/rust-data-structures-with...

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

#589

Earlier quoted context omitted.

He doesn’t need to be fluent in every language to set technical direction as a CTO. You don’t question a general’s war strategy simply because they aren’t accurate with a rifle.

>You don’t question a general’s war strategy simply because they aren’t accurate with a rifle. Thing is in this case their advice regards the rifle.

Right. So the general says we should use a different weapon. That’s fine. It’s also fine to question if that strategy makes sense.

It is nonsensical to say “the general can’t hit a moving target with the old rifle, so he should say nothing at all about weapons”. Which is what the person I replied to said.

Post reply on HN