(no title)
whatroot8 | 4 years ago
But then realize those horror stories were from 15+ years ago.
Did we need Rust?
Or did we need to build out the C and C++ ecosystems to make them easy and safe?
How many hours spent on all these languages for a few folks to build fiefdoms upon? Every human endeavor has a group of swindlers that tell you they’re helping but in hindsight often looks like they just got in the way.
rootlocus|4 years ago
C++ is nice and good until you hit a bug that leaks an abstraction and you realise you barely understand 10% of the language, and you'll never understand it completely, because people spend their entire careers trying to track down how language features interact and where they explode, and they're never finished.
[1] https://www.youtube.com/watch?v=JUxhwf7gYLg
belter|4 years ago
"CppCon 2018: Nicolai Josuttis “The Nightmare of Initialization in C++” https://youtu.be/7DTlWPgX6zs
Next Halloween I will dress up as std::variant
tialaramex|4 years ago
Epochs was the only halfway practical way to attempt the ever elusive step B of the "Smaller, better C++" idea, the part where you toss away all the stuff nobody needs. For many years now, the protestation has been that it's a great idea but first a few more things must be added. And then a few more. And a few more. Bjarne himself has a laundry list. Adding things to C++ is extremely ugly but it can be done and is still being done. However removing things is hard, and Epochs proposed a practical way to begin that work. It was shot down and I think years from now a C++ post mortem will pronounce that as at least contributing to the outcome if not outright the primary cause.
Epochs would have been really hard to do in C++ 20. But it isn't getting easier and the will to attempt such a thing seems to me to be finite.
DSingularity|4 years ago
whatroot8|4 years ago
Surely shining light on and fixing those issues would have resulted in C/C++ essentially becoming what Rust hopes to be.
But western kids needed to found new big business and institutionalize math.
Seems the west has a real issue with oligarchs needing to manage the masses. No one can be rich unless an institution has decided they are correctly rich.
Kototama|4 years ago
Edit: I think it's in this podcast https://corecursive.com/013-rust-and-bitter-c-developers-wit...
PaulDavisThe1st|4 years ago
Multithreaded programming without bugs is hard in any language, unless the language completely cripples your ability to do certain things that tend to be where the bugs can creep in.
If you religiously stick to the rules (e.g. mutexes around all variable use, mutexes and condition vars used correctly), you will not have bugs. The problems come because people do not religiously stick to the rules, because their language doesn't require them too.
The problem is that if you are forced to follow all the rules, then certain things become impossible, such as lock-free programming (even the simple single-reader, single-writer FIFO). The use of memory barriers to create provably safe lock-free code is outside the scope of regularized multithreaded programming, and since it's very very hard to get that write, but people want to try it anyway, that's where things go wrong.
Just use things the way you're supposed to and you won't have bugs with this.
whatroot8|4 years ago
[deleted]
belter|4 years ago
https://www.cvedetails.com/vulnerability-list/vendor_id-1224...
https://www.cvedetails.com/vulnerability-list/vendor_id-1224...
https://www.cvedetails.com/vulnerability-list/vendor_id-1224...
https://www.cvedetails.com/vulnerability-list/vendor_id-1224...
mempko|4 years ago
If you are starting a project from scratch with C++, you can avoid a lot of the pitfalls chrome's team has. Additionally Google has an arguably poor C++ coding style that is also completely out of date.
A company that uses C++ more effectively is arguably Adobe, who has the great Sean Parent.
emmanueloga_|4 years ago
Also, construction, destruction and move semantics makes everything really complicated and even simple baseline code requires a bunch of boilerplate [2].
1: https://www.boost.org/doc/libs/develop/libs/nowide/doc/html/...
2: https://gist.github.com/EmmanuelOga/12e1da5aedd9f6dc50e742cd...
AnimalMuppet|4 years ago
Rust does much more to force you to be safe. (Or, to put it differently, C++ still has all the unsafe ways available, and not locked away behind the "unsafe" keyword.)
bombela|4 years ago
unsafe mainly allows you to dereference pointers. References are guaranteed to be safe at all time, with an associated lifetime, while pointers can hold any possible memory address, valid or not (like in C++).
unsafe also let you promote a pointer to a reference by assigning a lifetime.
And finally, unsafe allows you to call functions themselves marked unsafe. One notable function is called transmute, and is very similar to how the the C style cast works in C++. It's the one that automatically selects between static_cast and reinterpret_cast depending on the context.
tialaramex|4 years ago
If so, the C++ committee wasn't interested in doing so. Preferring instead to say that new features don't have safety if there was any possibility that doing so might provide opportunity for improved performance.
Don't worry, when inevitably you blow your feet off with any of the new footguns provided, they'll be happy to tell you that it's your fault, a true C++ programmer would have known not to do that. "Git gud" as the gamers say.
MR4D|4 years ago
Backward compatibility is valuable, but so is letting go of old habits. With C++ and Rust, we can have our cake and eat it too. Plus, arguments about which language is better! ;)
woah|4 years ago
bborud|4 years ago
FpUser|4 years ago