4 ms·
It's high time we declare C "unsafe at any speed" and cease teaching it to every student. Only those who really need it (legacy C codebase, microcontroller with
by bitwize 4y ago
It's high time we declare C "unsafe at any speed" and cease teaching it to every student. Only those who really need it (legacy C codebase, microcontroller with a toolchain that doesn't yet support Rust) need to learn it.
- lionkor 4y agoHow do you tell apart a student that will later work on a legacy C codebase from one that won't?
- bitwize 4y agoYou don't. Let them learn C when they need to use C. Consider it a specialist language that is only used for certain tasks, like Fortran or COBOL -- not something everybody has to know.
- wudangmonk 4y agoI completely agree. Rust exists already so I do not understand why all the other languages need to continue existing. Only those that use Rust can be considered to be a good person since using Rust is the morally responsible thing to do. The question then becomes, why do we want more evil people in the world?. Does that make any sense? because that's exactly what you get when you don't use Rust.
- zbird 4y agoRust doesn't even have a formal specification at this time. Technically speaking, everything in Rust is undefined behaviour. That's a hard sell for, e.g., people writing safety-critical systems. Another problem recently was that compiling Rust required downloading a binary blob from Mozilla. That's a no-go for many projects.
- pjmlp 4y agoAUTOSAR is looking into it, while Ada Core is collaborating with Ferrous Systems to bring Rust to the kind of clients that usually use Ada. Meanwhile Microsoft has finally acknowledged picking C for Azure Sphere was a bad idea for its overall security story, and is now adding Rust support.
- zbird 4y agoI see, so it seems to be taking off then.
- simon_o 4y agoRealistically speaking, everything in C is undefined behaviour.
- suprjami 4y agoI get told off for making responses like this, but well done, you got a chuckle from me.
- absolut-dolt 4y agoImagine being this drunk on the kool-aid. Just telling on yourself, "I can't write software without training wheels", "I couldn't be bothered to learn how pointers work", so flagrantly. Rust is unspecified, lacks real battle testing, and lacks any substantial track record. Comparisons to C are comical, and discussing Rust as being a C replacement as if it were a forgone conclusion is just... I mean I can't think of any way to phrase this that won't result in a ban - so use your imagination. Rust is probably a fine language. A lot of y'all down the rabbit hole need a reality check though.
- pjmlp 4y agoPowering VSCode search engine, AWS Fargate infrastructure, ChromeOS and Android hypervisor infrastructure, Azure IoT, Firefox rendering engine, Android Bluetooth stack ....
- oconnor663 4y ago> cease teaching it to every student > Just telling on yourself, "I can't write software without training wheels" I think both of these reactions go too far, in opposite directions. Of course the fact that C is difficult doesn't mean that we should stop teaching it. It could just as well mean the opposite, that we need to teach it better, certainly as long as it stays in widespread use. But at the same time, we should acknowledge that C is difficult even for experienced professionals, and that "not knowing how pointers work" isn't the main reason every large C and C++ codebase on earth has memory corruption vulnerabilities. (I'm sure that's not literally true. Someone somewhere must've written a lot of perfect C code. But I think the usual posterchild for well-tested C is sqlite, and even sqlite has had memory corruption issues in the wild.)
- chlorion 4y agoYou can't write software without training wheels either, you just think you can. I know enough about C to know that I can't write it safely 100% of the time, especially when you introduce things like parsing untrusted input and threading. Thinking you can do this safely, and thinking you don't make mistakes suggests you actually don't know as much about C as you think you do. There number of subtle and unexpected things that cause UB are pretty concerning. Most of our software that we rely on day-to-day is filled with subtle bugs, many of which will eventually be exploited and used for RCE and other nasty things. I don't understand how that couldn't concern you! To be clear I don't think we should stop teaching C or anything that extreme. I don't think it should stop being used completely either. Mostly just that we should prefer safe languages when possible and practical, or use hardening features when we do use unsafe languages, like bounds checking for example. A lot of times I think we shouldn't even prefer rust, a lot of userspace software can be written in a GC'd language without issues.
- Kamq 4y agoC is unsafe. That's kind of the point of it. But just because it's unsafe doesn't mean it should never be used.
- pjmlp 4y agoIts use should be considered to the same extent as a macro assembler.
- bitwize 4y agoC is not just unsafe in the sense that it supports unsafe behavior. It's unsafe in the sense that it's nearly impossible for even clever, experienced programmers to write nontrivial amounts of code in it that don't have foot-shooting behavior in some form.
- userbinator 4y agoThis is surely what the authoritarian powers want. No rooting, no jailbreaking, no way to break out of the dystopia they will inevitably try to create. "Those who give up freedom for security deserve neither."