4 ms·
The real problem with C and C++ is you have to be an expert to not make disastrous errors. And you have to always get it right.
by trestenhortz 6y ago
The real problem with C and C++ is you have to be an expert to not make disastrous errors. And you have to always get it right.
- gypsyharlot 6y agoAnd the industry's experts who are famous for writing "idiomatic C" keep making mistakes constantly that result in new CVEs.
- Cthulhu_ 6y agoC/C++ is a potential footgun, but it has its place for applications where they need precise control.
- the-smug-one 6y agoYou're not precise though. Precise ought not mean "It is possible to express precise thought regarding memory, yada yada, in this language", it ought mean "A person is capable of expressing precise thought regarding [...] in this language, without making mistakes".
- tene 6y agoCould you offer some insight or examples of where or how C permits or enabled more-precise control than is permitted or enabled by Rust?
- wvenable 6y agoYou need unsafe in Rust just to do a doubly-linked list.
- tene 6y agoYes, I agree, you can implement a doubly-linked list in Rust exactly as you can in C, with the same precise control. You can even implement intrusive collections: https://docs.rs/intrusive-collections/ https://docs.rs/intrusive-collections/ Unsafe is a normal part of the language, and how you manually implement precise control behind a safe reusable abstraction whose correct use can be verified by the compiler. Do you have any examples of precise control you can express in C, but can't express in Rust?
- a1369209993 6y ago> You need unsafe in Rust just to [implement] a doubly-linked list. And? That's what unsafe is for.
- josefx 6y agoThere often is a choice of using a safer solution over raw performance. In C++ for example you can fight C strings, or you can just use std::string, there is no need to always go with the dangerous solution when that piece of code isn't a bottleneck.
- pjmlp 6y agoThe main problem here is how Animats refers on his post, 90% politics, and many organizations are too ingrained into C culture. It might not matter at all for what is being developed, but in no way are you going to spend those extra 5ms required for safer code.
- deleted 6y ago[deleted]