4 ms·
>C complicated? It is a very small, simple language That's a bit misleading though. Yes, C is very small - but that doesn't mean it's magically easy to underst
by ancarda 7y ago
>C complicated? It is a very small, simple language
That's a bit misleading though. Yes, C is very small - but that doesn't mean it's magically easy to understand. It's size has a huge consequence; the language doesn't do much for you, so it's up to you to fill in the gaps, e.g. correctly manage memory
- Koshkin 7y agoC is easy, programming, hard.
- elcritch 6y agoC is easy, programming it correctly, hard.
- DeathArrow 6y agoIt might depend on what you use C for. Programming web apps and lob software in C might be tough. As would trying to program systems software in Python or Java.
- gens 7y agohttps://stackoverflow.com/questions/21177436/is-there-a-published-language-format-standard-for-rust-yet https://stackoverflow.com/questions/21177436/is-there-a-publ... 6 years ago. I was going to compare how many pages the rust standard has, and compare it to the C standard (plus 20% for the "correctly manage memory" that you pointed out as something extremely complicated). http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf Anyway.. C is a rather simple language. No matter what the opinion of rust programmers is. Please don't respond to this post. At least not with the bog standard "undefined" "unsafe/memory" and other shallow conceptions.
- bsder 6y ago> plus 20% for the "correctly manage memory" Sorry. "correctly manage memory" in C is not 20% more problematic, it's like dividing by 0, infinity% more problematic. Nobody has gotten it right. Ever. Nobody. The Mozilla team switched from C to C++ trying to get memory right. Failed. Then they tried GC. Failed. Then they tried to go back to manual. Sill failed. So they wrote their own language to solve the problem--Rust. Jury is still out, but the situation is a lot better than when Mozilla started.
- xppq 6y agoSo the Linux or BSD kernels, which the "systems language" Rust necessarily runs on, have not gotten it right. It is good to hear this, since it affirms that Rust only thrives on hype and that I'm not missing out at all. EDIT: The Rust Strike Force is already downvoting. Webshit morons.
- aw1621107 6y ago> which the "systems language" Rust necessarily runs on Strictly speaking, Rust does not need to run on a kernel. If anything, the Rust developers have explicitly steered the language to be suitable for bare-metal situations. > So the Linux or BSD kernels... have not gotten it right ...Because they haven't? Just look at the CVE databases. A cursory search gives: * https://www.cvedetails.com/cve/CVE-2018-6916/ https://www.cvedetails.com/cve/CVE-2018-6916/ - FreeBSD: Improper validation and a use-after-free * https://www.cvedetails.com/cve/CVE-2019-5606/ https://www.cvedetails.com/cve/CVE-2019-5606/ - FreeBSD: Incorrect signal handling leading to write after free * https://www.cvedetails.com/cve/CVE-2019-15919/ https://www.cvedetails.com/cve/CVE-2019-15919/ - Linux: Use-after-free * https://www.cvedetails.com/cve/CVE-2019-15292/ https://www.cvedetails.com/cve/CVE-2019-15292/ - Linux: Use-after-free * https://www.cvedetails.com/cve/CVE-2019-15504/ https://www.cvedetails.com/cve/CVE-2019-15504/ - Linux: Double free In addition, Microsoft has said that ~70% of their CVEs are memory safety issues [0], and have been for many years. So no, easily accessible memory safety in C is not a solved issue yet. There are various techniques and tools that can be used to reduce or eliminate memory errors, but they have not seen widespread adoption for one reason or another. [0]: https://msrc-blog.microsoft.com/2019/07/16/a-proactive-approach-to-more-secure-code/ https://msrc-blog.microsoft.com/2019/07/16/a-proactive-appro...
- cpk10 6y agoThat 70% CVE figure is misleading: C and C++ obviously have a far higher market share, especially in fundamental Internet applications and kernels. So they have a higher number of CVE reports. But let's examine Rust despite its low market share: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-12083 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-1208... https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-1010299 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-1010... https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000810 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000...
- littlestymaar 6y agoDo you know how old and widely used C was when it got its spec ? The work on ANSI C started in 1983, 11 years after C came out. And it took 6 years! to complete. If Rust is as sucesful as C was during its 11 first years, Rust will most likely get a formal spec eventually. But don't hold your breath because it's going to take a loooong time to get there.
- defectbydesign 6y agoA language is only a tool to express something. Actually any language doesn't have to do more than expressing your ideas because you are in charge of your brain. If you can't manage memory like many drivers can't manage a manual gearbox, then use a garbage collector. ;-)
- Too 6y agoTo better illustrate this, compare with Brainfuck. It is also a very small, simple language. Its simplicity is at the same time its own worst enemy, in that it pushes down all the difficulties, complexities and verbosity for you to manage yourself. Perhaps an extreme comparison but just to show that simpler language doesn't always yield a simpler program.
- DeathArrow 6y agoI find C much simpler to learn and to write simple things in. If you learn C, you'll find that most used languages are compatible with C way of thinking. You can pick up C#, Java, Javascript, Python, PHP with ease as you kind of think in the same way. While Rust, the language might not be terribly complicated, you have a totally different paradigm, the restriction on variables and the borrowing system makes it totally different than the languages people are used to, to the point that for beginners is totally unintuitive. You can't just declare a variable, initialize it, pass it to a function and get a result back. You can't have self references in a structure. No, siree, as a beginner learning Rust you have to do a lot of complicated dancing around the borrow checker. Comming from C like languages I find even functional languages like F# easier to pick up. Because they feel more intuitive. Unlike Rust you kind of feel what kind of code you need to write to get a workable result. Right now I feel that the only advantage of Rust over other safe by default languages is speed. You can use low level constructs and unsafe features like raw pointers in C#, but the garbage collector for the safe code slows it down. I don't think garbage collected languages can ever be as fast as Rust. Reference counting like in Swift is another way to provide simplicity, but I see Swift is even slower than garbage collected languages. So if your use case needs both performance and safety, Rust is your best bet. It seems that from simplicity, performance, safety you can only pick two at once. Microsoft Research is working on a language inspired by Rust. I'm curious if they can come up with something as safe but easier to use. I wouldn't bet on it. They aren't convinced of the outcome since they recommended to write or rewrite parts of their software in Rust instead of waiting for the new magical language. A good thing from Microsoft evaluating Rust to use in their huge code base is they learned about a few weak points and are making recommendation to Rust team. One side effect of Microsoft embracing Rust might be that other corporations like Google and Oracle might avoid it to distance themselves from Microsoft.
- steveklabnik 6y agoGoogle already writes a bunch of Rust. Oracle did too, though the open source project seems abandoned and I’m not sure about the current state.
- pjmlp 6y agoGoogle is using Rust on Fuchsia, but isn't keen in exposing it to userspace apps. https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/docs/project/policy/programming_languages.md https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master...