Live data from Hacker News

I stopped everything and started writing C again

kmx.io

121–130 of 475 posts

Re: I stopped everything and started writing C again

#121
post #111
post #107

Earlier quoted context omitted.

> You wrote code, you knew roughly which instructions it translated to, and there you went! This must have been a very very long time ago, with optimizing compilers you don't really know even if they will emit any instructions.

On x86-type machines, you still have a decent chance, because the instructions themselves are so complicated and high-level. It's not that C is close to the metal, it's that the metal has come up to nearly the level of C! I wouldn't dare guess what a compiler does to a RISC target. (But yes, this was back in the early-to-mid 2000s I think. Whether that is a long time ago I don't know.)

I'd call it a while ago, but not a long time. Long time to me is more like 70s or 80s. I was born in 1996 so likely I'm biased: "before me=long time". It would be interesting to do a study on that. Give the words, request the years, correlate with birthyear, voila

Re: I stopped everything and started writing C again

#123
post #29
post #19

Earlier quoted context omitted.

Rust has three major issues: - compile times - compile times - compile times Not a problem for small utilities, but once you start pulling dependencies... pain is felt.

Long compile time isn't a new issue for language with advanced features. Before Rust, it was Haskell. And before Haskell, it was C++. And implementation wise, probably there's something to do with LLVM.

It is when the root cause is tooling, not language features.

You don't need to wait for long compile times in Haskell if you don't want to, there are interpreters and REPLs available as well.

You don't need to wait for long compile times in C++ if you don't want to, most folks use binary libraries, not every project is compiled from scratch, there are incremental compilers and linkers, REPLs like ROOT, managed versions with JIT like C++/CLI, and if using modern tooling like Visual C++ or Live++, hot code reloading.

Re: I stopped everything and started writing C again

#124
post #11

I fully understand that sentiment. For several years now, I have also felt the strong urge to develop something in pure C. My main language is C++, but I have noticed over and over again that I really enjoy using the old C libraries - the interfaces are just so simple and basic, there is no fluff. When I develop methods in pure C, I always enjoy that I can concentrate 100% on algorithmic aspects instead of architectu…

Most of the embedded world is still C, if you want to write C that's probably the place to find a community.

Re: I stopped everything and started writing C again

#125
post #108
post #101

Earlier quoted context omitted.

The C standard makes provisions for compiler implementers which absolve them from responsibility of ignoring the complexity of the C language. Since most people never actually learn all the undefined behavior specified in the standard and compilers allow it, it might seem the language is simpler, but it's actually only compilers which are simpler. You can argue that Rust generics are a trivial example of increased co…

True, if C wanted to be Rust it would be just as complicated. But who cares? The fact that C chooses not to nail everything down makes it a simpler and more flexible language, which is why it's sometimes preferred.

Undefined behavior does not make things simpler.

Re: I stopped everything and started writing C again

#126
post #111
post #107

Earlier quoted context omitted.

> You wrote code, you knew roughly which instructions it translated to, and there you went! This must have been a very very long time ago, with optimizing compilers you don't really know even if they will emit any instructions.

On x86-type machines, you still have a decent chance, because the instructions themselves are so complicated and high-level. It's not that C is close to the metal, it's that the metal has come up to nearly the level of C! I wouldn't dare guess what a compiler does to a RISC target. (But yes, this was back in the early-to-mid 2000s I think. Whether that is a long time ago I don't know.)

> I wouldn't dare guess what a compiler does to a RISC target.

Just let your C(++) compiler generate assembly on an ARM-64 platform, like Apple Silicon or iOS. Fasten your seat belt.

Re: I stopped everything and started writing C again

#127
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.

Re: I stopped everything and started writing C again

#128
post #8

I started programming with C a long time ago, and even now, every few months, I dream of going back to those roots. It was so simple. You wrote code, you knew roughly which instructions it translated to, and there you went! Then I try actually going through the motions of writing a production-grade application in C and I realise why I left it behind all those years ago. There's just so much stuff one has to do on one…

> Similar to C, but with much more help from the compiler with all sorts of things.

Is that not the problem rust was created to solve?

Re: I stopped everything and started writing C again

#129
post #8

I started programming with C a long time ago, and even now, every few months, I dream of going back to those roots. It was so simple. You wrote code, you knew roughly which instructions it translated to, and there you went! Then I try actually going through the motions of writing a production-grade application in C and I realise why I left it behind all those years ago. There's just so much stuff one has to do on one…

> I started programming with C a long time ago, and even now, every few months, I dream of going back to those roots. It was so simple. You wrote code, you knew roughly which instructions it translated to, and there you went!

Related-- I'm curious what percentage of Rust newbies "fighting the borrow checker" is due to the compiler being insufficiently sophisticated vs. the newbie not realizing they're trying to get Rust to compile a memory error.

Re: I stopped everything and started writing C again

#130
post #8

I started programming with C a long time ago, and even now, every few months, I dream of going back to those roots. It was so simple. You wrote code, you knew roughly which instructions it translated to, and there you went! Then I try actually going through the motions of writing a production-grade application in C and I realise why I left it behind all those years ago. There's just so much stuff one has to do on one…

> Similar to C, but with much more help from the compiler with all sorts of things. Is that not the problem rust was created to solve?

Rust is more like C++ (though still not really) than like C. Rust is a complete re-imagination of what a systems language could be.
Post reply on HN