by keyle · 2y ago · 0 comments
The thing to keep in mind is that *you* are the one throwing the razors and knives from the moment you go beyond printf("hello, world!\n");
I'd never recommend a company to start building anything in C. In term of the various team sizes and staff churn over the lifetime of a company, it's too risky.
But afaik most companies, particularly the growth hacking ones, are either Go or Kotlin or at that level of abstraction. Rust is slowly eating at C++ and I'm pretty sure no company in their right mind today start a new product in C++. It will slowly become COBOL.
C on the other hand still has new C written every day. I'm a polyglot and I love C, but I never had a job in C. I hope some day that happens. The modern tools aforementioned, e.g. static analysis, clangd, are really good.
The thing I love most about C is that there is a direct relationship between me doing something stupid and feeling pain for it. In python, I can write crap all day without feeling it. Some day I'll feel it, but not today!
I like small binaries and fast code. I like that when a developer tells me I did something wrong, they can prove it, and it's not some stupid high level language "the more you knoooow". I like control over things.
I love modern C and I wish it well!
I say this as someone who loves rust and zig, but these types of statements make me feel like HN is way out of touch with the industry. New products are constantly made in C++. That doesn't make it good (and i don't think companies building in C++ are making the best choices), but to say that no big tech company is writing any new code in C++ is just not correct. I see this happen every day at my job.
I also would definitely say more C++ code is written every day over C, although I'll say, I am not as familiar with the embedded world, but I know one HFT/Gaming/Robotics firm will have millions of new C++ lines every day.
I get exhausted by people denouncing C in favor of the language du jour, and suggesting it's been obsoleted by newer and especially more abstract languages. A hammer and nails are still useful for specific jobs, even if you have screws.
All tools have their trade offs. Even when you have a battery powered impact driver, sometimes you still need to pick up a basic hammer.
The library support for rust in key areas is terribly lacking and not everyone is a Microsoft that can afford to build the world from scratch.
As just one example a few valiant folks develop plugins and realtime audio with rust, but serious work that needs to get done today happens in C++.
I also wouldn't recommend starting a new thing with it if the whole team wasn't well-versed with it. On the other side of spectrum, today's world is well-served with python, c++ and rust (that battle is ongoing, I like both), java, heck even JS. There's something special about C though and I've yet to see something replacing it's place. Closest was D1, but that came and went.
Experience says otherwise. C code bases have serious longevity due to how many people know it and can jump in and contribute. There just aren't that many patterns and abstractions.
You and me both. I'm also a polygot but I originally started on interpreted languages like PHP and Python. I then learned some C, which was quite frustrating before I learned how to reason about memory ownership and hold myself to some idioms. Oh and Valgrind.
I then rewrote a bunch of projects in Rust and while it lead to correct and working software, it didn't spark the joy that C did for me. I don't exactly know why and at times I almost feel ashamed to mention this. I do hope there's a future where there's a version of C with some more substantial changes/improvements though, perhaps taking a lesson or two from Rust or Zig (eg string type w/ length).
The first thing I'd borrow from Rust are Option and Result for better error handling.
What's interesting, modern C, is promoting this move as well. Don't just return an integer, return a struct result_t with a fail bool or error bool in it, as opposed to some const char* pointing to null. Do this more and more and your C code starts becoming a lot more digestible and modern (although common sense still applies to not go overboard with these constructs in C, but you can set up a nice contract type API design within your code base).
Excellent! Such wisdom is rarely found in random forum threads on the internet.
I'm pretty sure this does not match reality.
> C on the other hand still has new C written every day
So does C++.
If you had a job in this you’d know that they are not ;)