Hacker News new | ask | show | jobs
by preg_match 10 days ago
I mean I just disagree fundamentally. It’s not trivial, it’s not convenient. It takes much, much more code and barely works when it does. And to top it off, it’s trivial to break, which is why we see it broken in just about every C codebase on the planet of any sort of large size.

That’s not to say C++ is perfect, it’s clearly not. It’s just that C is worse. The way I see it, there’s really no reason to ever write application code in C. It will take more code, it will be more buggy, and it will most likely be much slower. The reality is that garbage collected languages do often end up being faster because most allocation techniques in C and C++ are naive and expensive.

Which is why we see almost zero applications written in C. They’re written in Java, dotnet, Go, and others. Only low-level libraries are written in C these days because writing C sucks ass.

2 comments

If you decided that this is what you want to believe, I guess no argument will convince you. But note that I was programming in C++ before switching (almost) fully to C, and I am telling you that I prefer writing C - by a lot!
Take a look at raddebugger, it's written in C.

It compiles instantly (a full debug rebuild), starts instantly, have really nice GUI and are insanely fast and responsive. The codebase is very understandable and easy to hack on, and has as set of great abstractions that make all the supposedly annoying things in C (strings, memory allocation, multi threading) quite nice to use.

If you insist on using the C standard library and malloc()ing all over the place, using null terminated strings, complicated lifetime hierarchies and infinitely "generic code" (where you end up using max 1 or 2 different implementations/types in the end), then yes, you will have a bad time in C, but how about just not doing that?