Hacker News new | ask | show | jobs
by MauranKilom 750 days ago
As a younger programmer, I used to listen to people hating about everything C++ does, offers, or wants to be. Specifically https://yosefk.com/c++fqa/ [1]. Then I tasted the RAII (probably up there with Dynamic Programming for "horribly named but super powerful paradigms") koolaid, and threw my caution to the wind. It's been a pleasant ride since, even if I've been living in a somewhat comfy C++ environment with few third-party integration woes and a reasonable compiler upgrade pace.

Sure, I agree, you should carefully evaluate which language best serves your needs, and what tools in a language you should use or stay away from. But some game dev ranting about which C++ features they consider useless (without even articulating their background or constraints) is worthless imo. Especially if this is the credit they give to their name:

> After over 20 years working with C/C++ I finally got clear idea how header files need to be organized.

[1] Yes, that FAQ parody is now very outdated, seeing as it precedes even C++11. I can believe that it was on-point at the time of writing, but C++ grew up since then.

1 comments

C++ indeed has many gems like RAII, and many turds. My hope is that one of the last unavoidable turds (mandatory header files) gets replaced by modules but that seems eternally on the horizon.

Frankly I haven't used C++ since LLM copilots dropped, so that would address a lot of the tedium with managing headers in rapid greenfield development.

I have very mixed thoughts about headers, there is something I kind of love about being able to document the public declarations in one slim text file; and put the definitions elsewhere. There are lots of ways to do that, but other languages don't seem to bother. There are automated solutions, to pull these out, but I rarely see, for example, a python file will often just be a series of functions with no way to tell.

But they have a ton of warts, and require duplicate maintenance.

Python does enable this, actually. __init__.py can act as a "header" file that lets you define your porcelain interface separately from internal interfaces.
Typescript's .d.ts files are basically this
Modules nowadays mostly work, at least for VC++, clang 18 and cmake/msbuild.

My hobby C++ coding nowadays only uses modules.

For portable code, I imagine at least 5 years more, given experience with previous C++ standards.

I don't find the module workflow particularly valuable myself.

The main issue is that humans suck at defining module boundaries and managing dependencies.

Files are simple.

> The main issue is that humans suck at defining module boundaries and managing dependencies.

Thus microservices, nothing like putting process boundaries into what humans fail to learn to do properly, even better with a network in the middle.