7 ms·
I'm kinda in the opposite camp. After doing a bunch of VB in my tweens and teens, I learned Java, C, and C++ in college, settling on mostly C for personal and
by kelnos 2y ago
I'm kinda in the opposite camp. After doing a bunch of VB in my tweens and teens, I learned Java, C, and C++ in college, settling on mostly C for personal and professional projects. I became a core developer of Xfce and worked on that for 5 years.
Then I moved into backend development, where I was doing all Java, Scala, and Python. It was... dare I say... easy! Sure, these kinds of languages bring with them other problems, but I loved batteries-included standard libraries, build systems that could automatically fetch dependencies -- and oh my, such huge communities with open-source libraries for nearly anything I could imagine needing. Even if most of the build systems (maven, sbt, gradle, pip, etc.) have lots of rough edges, at least they exist.
Fast forward 12 years, and I find myself getting back in to Xfce. Ugh. C is such a pain in the ass. I keep reinventing wheels, because even if there's a third-party library, most of the time it's not packaged on many of the distros/OSes our users use. Memory leaks, NULL pointer dereferences, use-after-free, data races, terrible concurrency primitives, no tuples, no generics, primitive type system... I hate it.
I've been using Rust for other projects, and despite it being an objectively more difficult language to learn and use, I'm still much more productive in Rust than in C.
- cryptonector 2y agoBut TFA is not writing in C. TFA is writing in a language that compiles to C.
- kstrauser 2y agoI think Rust is harder to learn, but once you grok it, I don't think it's harder to use, or at least to use correctly. It's hard to write correct C because the standard tooling doesn't give you much help beyond `-Wall`. Rust's normal error messages are delightfully helpful. For example, I just wrote some bad code and got: --> src/main.rs:45:34 | 45 | actions.append(&mut func(opt.selected)); | ---- ^^^^^^^^^^^^ expected `&str`, found `String` | | | arguments to this function are incorrect | help: consider borrowing here | 45 | actions.append(&mut func(&opt.selected)); | I even had to cheat a little to get that far, because my editor used rust-analyzer to flag the error before I had the chance to build the code. Also, I highly recommend getting into the habit of running `cargo clippy` regularly. It's a wonderful tool for catching non-idiomatic code. I learned a lot from its suggestions on how I could improve my work.
- kelnos 2y ago> I think Rust is harder to learn, but once you grok it, I don't think it's harder to use, or at least to use correctly. It's hard to write correct C because the standard tooling doesn't give you much help beyond `-Wall`. When I say Rust is harder to use (even after learning it decently well), what I mean is that it's still easier to write a pile of C code and get it to compile than it is to write a pile of Rust code and get it to compile. The important difference is that the easier-written C code will have a bunch of bugs in it than the Rust code will. I think that's what I mean when I say Rust is harder to use, but I'm more productive in it: I have to do so much less debugging when writing Rust, and writing and debugging C code is more difficult and takes up more time than writing the Rust code (and doing whatever less debugging is necessary there). > Also, I highly recommend getting into the habit of running `cargo clippy` regularly. It's a wonderful tool for catching non-idiomatic code. That's a great tip, and I usually forget to do so. On a couple of my personal projects, I have a CI step that fails the build if there are any clippy messages, but I don't use it for most of my personal projects. I do have a `cargo fmt --check` in my pre-commit hooks, but I should add clippy to that as well.
- sestep 2y agoIf you're using VS Code then you can add `"rust-analyzer.check.command": "clippy"` to your `settings.json`. I assume there's a similar setting for rust-analyzer in other editors.
- maleldil 2y agoNeovim: require("lspconfig").rust_analyzer.setup({ settings = { ["rust-analyzer"] = { checkOnSave = { command = "clippy", allFeatures = true, }, }, }, })
- pabs3 2y agoYou might want to reconsider use of rust-analyzer, it isn't safe to use on code you haven't written yourself. https://rust-analyzer.github.io/book/security.html https://rust-analyzer.github.io/book/security.html
- eikenberry 2y agoHave you looked at Zig? It is often termed a modern C where Rust is the modern C++. Seems like a good fit.
- harrison_clarke 2y agoi never really understand why these get compared. i wouldn't expect that much overlap in the audiences zig seems like someone wanted something between C and "the good parts" of C++, with the generations of cruft scrubbed out rust seems like someone wanted a haskell-flavoured replacement for C++, and memory-safety i would expect "zig for C++" to look more like D or Carbon than rust. and i'd expect "rust for C" to have memory safety and regions, and probably steal a few ocaml features
- elteto 2y agoThe single best feature (and I would say the _core_ feature separating it from C) that C++ has to offer is RAII and zig does not have that. So I don’t know which good parts of C++ they kept. Zig is more of its own thing, and they take from wherever they like, not just C++.
- naasking 2y ago> So I don’t know which good parts of C++ they kept. comptime is a better version of C++ templates.
- jandrewrogers 2y agoI really wish that were true but it isn’t. Modern C++ templates/constexpr are much more powerful and expressive than any Zig comptime equivalent. The power and expressiveness of the C++ compile-time capabilities are the one thing I strongly miss when using other languages. The amount of safety and conciseness those features enable makes not having them feel like a giant step backward. Honestly, if another systems language had something of similar capability I’d consider switching.
- Sysreq2 2y agoI will say the more recent additions to C++ at least have solved many of my long standing issues with that C-variant. Most of it was stuff that was long overdue. Like string formatting or a thread safe println. But even some of the stuff I didn’t think I would love has been amazing. Modules. Modules bro. Game changer. I’m all in. Honestly C++ is my go to for anything that isn’t just throw away again. Python will always be king of the single use scripts.
- klysm 2y agoThe problem is that they are _additions_, C++ has such absurd sprawl. The interactions between everything in this massive sprawl is quite difficult to grasp
- silisili 2y agoThat's also a problem in C land, of course, perhaps with less total sprawl. Yeah, it has new features, but you're stuck working on a C89 codebase, good luck! I don't know a great answer to that. I almost feel like languages should cut and run at some point and become a new thing.
- ahartmetz 2y agoPerhaps less? More like certainly a ton less. Regards, someone who uses C++ and doesn't even hate it.
- kelnos 2y agoI lost interest in keeping up with C++'s advances more than a decade ago. The problem is that I want a language where things are safe by default. Many of the newer stuff added in C++ makes things safe, perhaps even to the level of Rust's guarantees -- but that's only if you use only these new things, and never -- even by accident -- use any of the older patterns. I'd rather just learn a language without all that baggage.
- BuckRogers 2y agoThat is very interesting. You have quite the resume too. While I've dabbled in nearly everything, I'm a day to day pro C# developer and I absolutely love it. I've never been upset or had a complaint. If I were forced off for some reason, I'd just go to Typescript. I can't imagine using C. Perhaps with some form of AI valgrind. The problems C solved are just not relevant any longer, and it remains entrenched in 2025. Rust with AI analysis will be amazing to see the results of.
- tartoran 2y agoIt depends on problem domain. If you're writing kernel level code or device drivers you wouldn't use C# or typescript.
- thodg 2y ago[dead]
- p_ing 2y agoThere are at least a few kernels, bootloaders, and device drivers written in C# out there… granted for hobby/research. https://github.com/Michael-K-GH/RoseOS https://github.com/Michael-K-GH/RoseOS https://vollragm.github.io/posts/kernelsharp/ https://vollragm.github.io/posts/kernelsharp/ https://www.gocosmos.org https://www.gocosmos.org https://www.microsoft.com/en-us/research/project/singularity/ https://www.microsoft.com/en-us/research/project/singularity... (asm, C, C++, largely C# (Sing#))
- codr7 2y agoIt looks to me like C is still very relevant, and isn't going anywhere anytime soon. I realize a lot of people don't want to use it; and that's fine, don't use it.
- samiv 2y agoThe biggest problem with C is that doesn't even have enough features to help you build the features and abstractions you need and want. For example with C++ the language offers enough functionality that you can create abstractions at any level, from low level bit manipulation to high level features such as automatic memory management, high level data objects etc. With C you can never escape the low level details. Cursed to crawl.
- ChrisMarshallNY 2y agoJust FYI. Back in 1994/95, I wrote an API, in C, that was a communication interface. We had to use C, because it was the only language that had binary/link compatibility between compilers (the ones that we used). We designed what I call "false object pattern." It used a C struct to simulate a dynamic object, complete with function pointers (that could be replaced, in implementation), and that gave us a "sorta/kinda" vtable. Worked a charm. They were still using it, 25 years later. That said, I don't really miss working at that level. I have been writing almost exclusively in Swift, since 2014.
- PaulDavisThe1st 2y ago> We designed what I call "false object pattern." It used a C struct to simulate a dynamic object, complete with function pointers (that could be replaced, in implementation), and that gave us a "sorta/kinda" vtable. You were not alone in this. It is the basis of glib's GObject which is at the bottom of the stack for all of GTK and GNOME.
- synergy20 2y agosadly glib doesn't have error handling for memory errors,it will just crash. otherwise it can be widely used as a oop c
- ChrisMarshallNY 2y agoI got the idea from Apple's QuickDraw GX. It used a similar pattern.
- 2y ago
- WalterBright 2y ago> Memory leaks, NULL pointer dereferences, use-after-free I suffered writing those for many years. I finally simply learned not to do them anymore. Sort of like there's a grain of sand on the bottom of my foot and the skin just sort of entombed it in a callous.
- kelnos 2y agoI've seen you make these kinds of comments before on other articles. Please stop. Not everyone is perfect and can forevermore avoid making any mistakes. I strongly suspect your opinion of your skill here is overinflated. Even if it isn't, and you really are that good, everyone cannot be in the top 0.00001% of all programmers out there, so your suggestion to "simply" learn not to make mistakes is useless. This all just comes off incredibly arrogant, if I'm being honest.
- BigJono 2y agoYou come off as incredibly arrogant too, you just don't realise it because you have the current mainstream opinion and the safety of a crowd. Do you know how fucking obnoxious it is when 200 people like you come into every thread to tell 10 C or Javascript developers that they can't be trusted with the languages and environments they've been using for decades? There are MILLIONS of successful projects across those two languages, far more than Rust or Typescript. Get a fucking grip.
- Klonoar 2y agoNobody is telling JS developers that Rust will save them, chill.
- pansa2 2y agoBut you'll be called things like "catastrophically unprofessional" [1] if you choose JavaScript over TypeScript, or dynamically-typed Python over MyPy. [1] https://www.reddit.com/r/Python/comments/1iqytkf/python_type_hints_and_why_you_should_use_them/ https://www.reddit.com/r/Python/comments/1iqytkf/python_type...
- quchen 2y agoThank you for your work on XFCE. It's been the best WM/UI for me for over a decade.
- jakogut 2y agoSimilarly, I went from writing a lot of C to Python, and I appreciate both of them for almost opposite reasons. I ended up finding I like Cython quite a bit, even though the syntax leaves much to be desired. The power, performance, and flexibility of C combined with the batteries included nature of Python is a match made in heaven. You're also still very much free to write either language purely, and "glue" them together easily using Cython.
- mrheosuper 2y agoI Really want to use Rust. But Rust has so many std functions that kind of abstracting how does it work under the hood For Ex: I still has no idea what clone() does, how does it interact with memory, on heap or stack , does it create a new instance, or just modify metadata of that object. Sometime creating a new instance is a big no-no because it takes a lot of memory. Same thing with "ownership transfer", is variable freed at that moment, etc. I bet i could find answers on internet, but rust has like 500 std functions, so the task is tedious
- jpc0 2y agoWhat is your current language of choice, both C and C++ have the same problems as what you just described. Regarding ownership transfer it is even worse in C, what if you forget, after moving an object out of a variable, to set that variable to NULL, then free that variable, that's a use after free. At least in C++ you have move semantics although it is still error prone. In rust it's a compiler error. Copy and Clone is the same, and both are opt-in for your own types, by default the only options are move or reference for your own types, in C and C++ by default it is copy, which again leads to use after free in the situations you complained about. I feel if these are your complaints you will actually benefit from spending some time in Rust. If your preferred language is higher level languages with GC that is reference by default I encourage you to try any of the systems level programming languages, the things you complain about are things that are important for a language to have constructs for, reference semabtics by default causes many issues, and becomes untenable in the parallel world we live in.
- mrheosuper 2y agoWell, i dont use C++ much(i'm FW engineer, most of my stuff is in C). The std in C is simple and explicit. For Ex: I can make an educated guess how memcpy() work by looking at its signature. It takes pointer to src and destination, and size, so i can guess it does not allocate any new memory(or if it has, it has to be some kind of optimization reason). Another example is strstr(), it returns pointer to a piece of memory i provided to it, so i can safely do some pointer math with the return value. It's true that i do not spend much time in Rust, so maybe i'm missing some fundamental things. I guess my mistake is trying to apply my knowledge in C to rust. But still, it's kind of irritating now knowing (or guessing) how does function work just by looking at at its signature.
- doublerabbit 2y agoLately I've been paying interest in D being from PERL/TCL background. Rust, Python, Go just feel tainted to me. https://dlang.org https://dlang.org
- tealpod 2y agoDlang is a clean langauge. Unfortunately it never got the attention it deserves.