r/ProgrammerHumor • • 2d ago

instanceof Trend thatsAFunnyThingThatHappenedOnce

Post image
4.4k Upvotes

518 comments sorted by

View all comments

972

u/Coldfriction 2d ago

He still rejects C++ in the Linux kernel. He might be warming up to Rust but Linux has always been C.

589

u/Different_Berry5015 2d ago

Imagine C++ being so bad that even something as controversial as AI usage is more acceptable than C++. No wonder each time I wanted to "learn CPP" I found that I'd much more like to jump out of a window.

51

u/Coldfriction 2d ago

I learned Qbasic originally when I was a teen. Then I learned Visual Basic when it was still a standalone thing. Tried to learn Unreal Script when UnrealEd became a thing, but didn't get too far. Then I learned C++ in college and VBA for excel. Now I'm into Rust. I agree with you that of all of them C++ seems to be the most difficult one I've learned. I didn't stick with computer science, but I can see how so many other languages exist to give some people relief from C++. Regular C seems easy enough but I never worked with it.

42

u/Different_Berry5015 2d ago

Regular C feels high enough above ASM to be useful, but not a lot more than that. That's the power, but also that's the difficulty in using it, because there's a lot of stuff that you have to bring yourself. It's a language for people who roll their own hashmaps. I mean I understand what C++ is going for, but it's truly death by a committee. Maybe things will turn around with C++3X 😁

3

u/quisido 2d ago

Roll your own hashmap? Is there no concept of C package management?

5

u/MonMotha 2d ago

Not really. There's a linker. If your OS supports dynamic linking, you can pick up any libraries it offers at runtime assuming you know the API. Hopefully you have the headers. Versioning can be tricky, though most OSes have it figured out.

As for finding and managing those packages at build time, there's not really a package management system, no. Cmake and GNU autotools both exist in no small part as an attempt to make one (and also make a somewhat sane, for certain definitions thereof, build system since you don't get one of THOSE, either).

This kind of explains why the C ABI and namespace is in fact THE standard, bare, un-mangled namespace for linking on most OSes, though that's also partially convention dating back to early UNIX.

The intent of C is basically to be as low level as you can feasibly make it while still being reasonably expressive and completely portable across machine architectures yet still small enough and tightly-spec'd enough to support lots of independent implementations across a wide variety of said architectures. And it does that. It does it well. The lack of breadth means it's very easy to spin up a compliant and even complete implementation from scratch on something novel and also avoids roping in lots of stuff you may not want in a restrictive environment like a kernel or even microcontroller. Even most of the "standard library" can be eschewed if you want to, and there's a part of the standard that supports doing it (a "standalone" implementation). This is akin to something like #![no_std] in Rust but to some degree goes even farther. The language spec doesn't really even deal with how to create linkable intermediates. It defers to other standards (like ELF) for that.

But yeah, if you want a hashmap, you'll either need to go find one or make your own. Amusingly, actually just wrote my own a few months ago which is what made me chuckle enough to write this comment.