Live data from Hacker News

Switching to C over 'Modern' Programming Languages

devtails.xyz

21–30 of 170 posts

Re: Switching to C over 'Modern' Programming Languages

#21

Other than assembly language, all languages embody abstractions. I find understanding certain abstractions hard going because they don't mesh well with my view of the problem domain and my design for solution's implementation.

Yep. You think C is "low level", but it was once considered "high level", and the compiler does many things you don't want, and the standard's ambiguously-worded, and implementers have their own interpretations about the ambiguity, and also bugs in their compilers, and you eventually arrive at: "If you really want those instructions to happen in this function, without fear of magic, write them in assembly."

> but it was once considered "high level"

C's position in the "low- vs high-level" hierarchy arguable hasn't changed much since it was created. There were already higher level languages in the 60's (e.g. languages which abstracted the underlying hardware much more than C, but those weren't useful for writing an operating system in).

Re: Switching to C over 'Modern' Programming Languages

#22

Earlier quoted context omitted.

I still cannot figure out how to easily write small applications with Rust on low resource computers, like the one I'm typing this from. (Limited storage, CPU, memory.) It seems even the smallest programs require a massive toolchain. The default reliance on network connection for compilation is offputing. It's vastly easier for me to write small programs, offline, with C. The rationale for using Rust over C that I se…

That's a point I was trying to make multiple times - that C (apart from O/S code and drivers) is used for small command line utilities and language runtimes of higher-level languages. Nobody (except maybe game devs) wants to develop fat application server binaries or other long running server apps in C++ or other non-GC'd environments (due to memory fragmentation issues alone if not other things). And for a language…

There are tons of CLI utilities developed in Rust that are faster and safer than their C/C++ equivalents. See for examples ripgrep.

Re: Switching to C over 'Modern' Programming Languages

#23
post #9

Don’t expect to see immediate benefit from Rust by writing a small Pong application. Rust gives you confidence at scale: the ability to depend on many 3rd party blocks without compromising stability or performance, the ability to grow and maintain the code, collaborate on it, etc. Nothing of this is easily seen on a small self-contained program you can write in C.

I still cannot figure out how to easily write small applications with Rust on low resource computers, like the one I'm typing this from. (Limited storage, CPU, memory.) It seems even the smallest programs require a massive toolchain. The default reliance on network connection for compilation is offputing. It's vastly easier for me to write small programs, offline, with C. The rationale for using Rust over C that I se…

Er the modern C stack has basically the same components as the modern Rust stack: a language frontend (say Clang or rustc) interfacing with LLVM or GCC. You could use an alternate C compiler from these two, but, really, why would you?

Re: Switching to C over 'Modern' Programming Languages

#24

Earlier quoted context omitted.

I still cannot figure out how to easily write small applications with Rust on low resource computers, like the one I'm typing this from. (Limited storage, CPU, memory.) It seems even the smallest programs require a massive toolchain. The default reliance on network connection for compilation is offputing. It's vastly easier for me to write small programs, offline, with C. The rationale for using Rust over C that I se…

That's a point I was trying to make multiple times - that C (apart from O/S code and drivers) is used for small command line utilities and language runtimes of higher-level languages. Nobody (except maybe game devs) wants to develop fat application server binaries or other long running server apps in C++ or other non-GC'd environments (due to memory fragmentation issues alone if not other things). And for a language…

C is used for the whole Linux kernel and not just "utilities".

Re: Switching to C over 'Modern' Programming Languages

#25

I’ve been enjoying writing libraries in C and being able to use them both from native applications and in web apps via WASM. I personally avoid emscripten and just implement the minimal C/JS glue and utilities myself.

What library or such if any do you use for string.h/math.h/snprintf and such?

Re: Switching to C over 'Modern' Programming Languages

#26
post #16

Is this becoming a thing now (or maybe it was always a thing), where a language, like Rust, has become popular enough that instead of everyone talking about learning it, they now want to talk about how “simple” and “beautiful” C is for no other reason than signaling how different you are from the zeitgeist? Rust exists for a reason, and it solves specific problems. That’s the “magic”, just like any abstraction in any…

Yeah I agree

These people (with rare exceptions) quite funnily never seem to have shipped some actual product or service based on those "simpler" languages. Or if they have it's shipping their parallel implementations of basic services that every language does better than C like strings, slices, data structures, etc. And no, if your code depends on cpp macro magic, it is not helping your point.

Re: Switching to C over 'Modern' Programming Languages

#27

Earlier quoted context omitted.

I still cannot figure out how to easily write small applications with Rust on low resource computers, like the one I'm typing this from. (Limited storage, CPU, memory.) It seems even the smallest programs require a massive toolchain. The default reliance on network connection for compilation is offputing. It's vastly easier for me to write small programs, offline, with C. The rationale for using Rust over C that I se…

That's a point I was trying to make multiple times - that C (apart from O/S code and drivers) is used for small command line utilities and language runtimes of higher-level languages. Nobody (except maybe game devs) wants to develop fat application server binaries or other long running server apps in C++ or other non-GC'd environments (due to memory fragmentation issues alone if not other things). And for a language…

[deleted]

Re: Switching to C over 'Modern' Programming Languages

#28
post #16

Is this becoming a thing now (or maybe it was always a thing), where a language, like Rust, has become popular enough that instead of everyone talking about learning it, they now want to talk about how “simple” and “beautiful” C is for no other reason than signaling how different you are from the zeitgeist? Rust exists for a reason, and it solves specific problems. That’s the “magic”, just like any abstraction in any…

> they now want to talk about how “simple” and “beautiful” C is for no other reason than signaling how different you are from the zeitgeist?

It sounds to me like they keep learning languages with the same illusions and failing to take any lessons between their language exploration escapades.

All programming languages suck. It's just about finding the one that sucks the least for you (or your project/business).

They made the comparison of RPG characters and mentioned endgame frustrations. In my experience, C is the epitome of endgame frustrations (C++ maybe being worse, depending on codebases you work on); they've just yet to discover that

Re: Switching to C over 'Modern' Programming Languages

#29
post #16

Is this becoming a thing now (or maybe it was always a thing), where a language, like Rust, has become popular enough that instead of everyone talking about learning it, they now want to talk about how “simple” and “beautiful” C is for no other reason than signaling how different you are from the zeitgeist? Rust exists for a reason, and it solves specific problems. That’s the “magic”, just like any abstraction in any…

As someone who should like the proposition of C after having read a few books on it I decided to avoid the language if I can. Read: I wanted to like the language, but the deeper I went into it the more I realized that the absolute knowledge of everything needed to wield it is not something that is worth aquiring.

I understand most of the historical reasons why certain things in the language are the way they are, but some of those result in really bad ergonomics and counterintuitive behavior.

So simple and beautiful is not how I would describe C even if I would love it to be that way.

Re: Switching to C over 'Modern' Programming Languages

#30
post #16

Is this becoming a thing now (or maybe it was always a thing), where a language, like Rust, has become popular enough that instead of everyone talking about learning it, they now want to talk about how “simple” and “beautiful” C is for no other reason than signaling how different you are from the zeitgeist? Rust exists for a reason, and it solves specific problems. That’s the “magic”, just like any abstraction in any…

While I agree, I also have to say that Rust does a lot more than just solve some specific C and C++ issues. It doesnt solve all of them (e.g. logic errors, so if thats 90% of your issues you wont benefit too much), it repeats some design issues of C++ (massive complexity from the start, many ways to do the same thing), and implements a C-like unsafe{} language anyways.

If Rust was just C but with strong typing, a borrow checker and what would basically be suoer strong static analysis of pairing malloc() and free(), people would likely switch immediately.

But it isnt - its a whole different beast which by far is not perfect and repeats many issues it didnt need to repeat (e.g. terrible async like python).

Its just so good at having a compiler that tells you whats wrong that most of the other things are not that bad, and switching to Rust is likely good for 80%+ of C projects.

Post reply on HN