Live data from Hacker News

Switching to C over 'Modern' Programming Languages

devtails.xyz

41–50 of 170 posts

Re: Switching to C over 'Modern' Programming Languages

#41

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…

Lots of people write complex, latency dependent code.

Previously they would write in something like C/C++ or use the JVM but try to avoid all garbage collection events though very carefully avoiding allocations, etc.

For them, Rust is a gift!

https://blog.scottlogic.com/2021/12/01/disruptor.html

Re: Switching to C over 'Modern' Programming Languages

#42

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's a ton of big productivity desktop applications written in C++ (which almost always also includes a significant amount of C code in 3rd-party libraries), pretty much all 3D modelling/animation tools, Photoshop, browsers...

Also: memory fragmentation is only an issue if you don't have a proper memory management strategy (which you absolute need in any non-trivial code base, even in GC'ed languages).

Re: Switching to C over 'Modern' Programming Languages

#43
post #24

Earlier quoted context omitted.

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".

Once the Asahi drivers get up streamed it won’t be the whole kernel anymore.

Re: Switching to C over 'Modern' Programming Languages

#44

I've been learning Rust lately. Working on a little game. First few thousand lines of code in I was having some doubt. After being a little frustrated with borrows and lifetimes and with my strong tendency to prematurely optimize all the things I was soooo tempted to just switch to C and have full unfettered access to my sweet sweet pointers. I'm glad I haven't switched though. Performance (which I'm measuring a ton…

"Rust forces me to think a little bit more [..]"

My reaction to that has always been that it forces us to think about the things we would have had to think anyways if we wanted to create reasonably reliable and secure software. So in the end if saves work, even if it doesn't appear like that at first.

Re: Switching to C over 'Modern' Programming Languages

#45
The author appears to be quite green behind the ears, which is fine! They’re certainly doing themselves a disservice by being so sure of themselves. There’s a lot here that feels right in the pocket of Dunning-Kruger ignorance.

Being able to analyse the benefits of new tech at a distance (which is what the author is doing with their sterile toy projects) is not something that you can “fake until you make it”. It requires a lot of deep experience with different technologies, enough that you can pick up the common patterns of costs and benefits, which for the most part never change. This is exactly what OP is doing. Their big list of languages they’ve worked with is doing the opposite of what the author intends. All it says to me is that their bar is way too low, and that they do not understand the level of technological understanding required for a language’s inclusion in that list to mean absolutely anything in the context of this blog post.

In all I’m not really sure what the point of this post is. By the author’s own admission they haven’t worked with much C. If someone doesn’t understand the value in a language that addresses the memory safety footguns of C, I assume that they’re at best inexperienced, or at worst part of the quite sizeable contingent of C developers that are in complete denial about the language / standard library’s shortcomings, especially with regard to memory safety, because it’d require them to admit that they themselves are imperfect developers.

Re: Switching to C over 'Modern' Programming Languages

#46

I've been learning Rust lately. Working on a little game. First few thousand lines of code in I was having some doubt. After being a little frustrated with borrows and lifetimes and with my strong tendency to prematurely optimize all the things I was soooo tempted to just switch to C and have full unfettered access to my sweet sweet pointers. I'm glad I haven't switched though. Performance (which I'm measuring a ton…

"Rust forces me to think a little bit more [..]" My reaction to that has always been that it forces us to think about the things we would have had to think anyways if we wanted to create reasonably reliable and secure software. So in the end if saves work, even if it doesn't appear like that at first.

This is precisely what abstractions are meant to solve. If you’re needing to think about something “anyway”, then it’s a leaky abstraction.

Re: Switching to C over 'Modern' Programming Languages

#47
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…

What the hell does it have to do with “low-resource computers”? Are you using a feature phone or what? Otherwise I can honestly can’t see how your hardware would be the bottleneck (I assume your problem is compile times).

Rust’s compiler is slightly slower than many other languages (as it simply does more), but it’s not a significant degree where you would need some monster machine..

Re: Switching to C over 'Modern' Programming Languages

#48
post #11
post #7

Earlier quoted context omitted.

Then you realize that your CPU has hardware bugs, and you go design and manufacture your own CPU :).

“I don’t get much programming done these days, what with all the goat herding…”

You mean atom moving?

I just move atoms until the program I desire is on the computer.

Re: Switching to C over 'Modern' Programming Languages

#49

Earlier quoted context omitted.

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's a ton of big productivity desktop applications written in C++ (which almost always also includes a significant amount of C code in 3rd-party libraries), pretty much all 3D modelling/animation tools, Photoshop, browsers... Also: memory fragmentation is only an issue if you don't have a proper memory management strategy (which you absolute need in any non-trivial code base, even in GC'ed languages).

It’s pretty reasonable to argue that were these things written again, less than 100% of it would be in C[++]. It’d also pretty reasonable to argue that that percentage will be even smaller 5 years from now.

Re: Switching to C over 'Modern' Programming Languages

#50
Using a memory unsafe language in a situation where it's not strictly necessary is in my opinion not justifiable at all. It's the leading cause for security issues by some measures[1], incredibly hard to reason about and hard to debug. Honestly unless you have a really, really, good reason not to, use a managed language. If that isn't good enough and you want to be fancy use Rust and only if you've exhausted everything else start writing C.

[1]https://www.zdnet.com/article/microsoft-70-percent-of-all-se...

Post reply on HN