Live data from Hacker News

C++: The Documentary

herbsutter.com

51–60 of 334 posts

Re: C++: The Documentary

#51

Earlier quoted context omitted.

The language is fine, mostly, nowadays. The ecosystem isn't fine - just to get a project going requires picking a non-trivial set of tools and approaches, none of which the C++ standard enforces or guides to. For example, will you manage dependencies via packages? If so, with what? What will you use for building your project? The list goes on and on.

I personally find the lack of native package management in C++ as a blessing. Go, Python, Rust has it, and this always causes pulling in infinite number of packages for any trivial operation. sudo-rs was pulling in 1M+ LOC as its dependency chain at one point. I believe they removed the biggest offenders, but I didn't check it recently.

That's one way to look at it, certainly. There are several OK options in that space, e.g. Conan (2) and vcpkg.

Re: C++: The Documentary

#52

Earlier quoted context omitted.

Personally I don't find programming with C++ that hard. The downside is it needs a brain warm-up, and this is per project, but once that flywheel is spinning, I find it almost effortless to write code. I have to go through the same warm-up more or less for any language I work with, so it's not that different than writing Python, Go or Java for me.

> The downside is it needs a brain warm-up, and this is per project, but once that flywheel is spinning, I find it almost effortless to write code. How is that different from other languages, which don't need the brain warm-up?

The difference, if you split hairs, that the brain warm-up takes a bit longer. Maybe a couple of hours, or a day at most.

Otherwise it's not different for me. I don't feel different while writing with any other language. I guess the main reason is I always think like the computer first and translate that thinking to the programming language at hand.

Re: C++: The Documentary

#53

Earlier quoted context omitted.

Grossly exaggerated or misunderstood in many cases. Some of their arguments are just flat-out wrong. I mean, why are they blaming the standard library for inherent properties of linked lists? Yeah, you don't want to use them without good reason. That's just called picking the right data structure for the job, not a flaw with the standard library. Some of the other choices were tradeoffs between performance and usabil…

As I understood the article, the main critique is that the stdlib has no concept of deprecation and breaking backward compatibility. E.g. the C++ committee is quick to add badly designed features to the stdlib but then can't roll them back when people actually realize that those new features are useless for most real-world code.

Yet they spend a lot of time complaining about features that were deprecated or removed.

Re: C++: The Documentary

#54
post #31

Earlier quoted context omitted.

For games, C++ becomes a much simpler language since game code bases usually ignore the C++ stdlib (at least mostly, and for good reasons, e.g. see [0]). And without the stdlib C++ is actually kinda-sorta okay-ish. Related, the main problem with the C++ ecosystem is that everybody carves out their own language subset, so it's not one ecosystem but many ecosystems with contradicting styles and language/stdlib subsets.…

If you don't use the STL you end up re-implementing it yourself. Usually poorly.

some of the STL is easy to improve on. For example, std::unordered_map performs poorly due to pointer stability requirements in the standard. Most performance sensitive C++ codebases will use something like abseil's hash maps instead.

Re: C++: The Documentary

#55

Earlier quoted context omitted.

If this is a rhetorical question I genuinely don't know what's the implied answer. Why would AI specifically make C++ grow?

A few reasons: 1. Header files make C++ verbose. Header files are well within LLM's ability 2. LLMs can handle setting up cmake for you 3. C++ is very well documented relative to (most) newer languages 4. LLMs can port modern features like websockets and build API wrappers easily, reducing the disadvantage against web (since most documentation is for JS/python/go) Coding languages have been developing for speed of (m…

Yeah, C++, the language known for its speed of reading...

Re: C++: The Documentary

#56
post #11

It's surprising that C++'s development trend continues. When a game or program is made with C++, it's usually nice because performance is mostly guaranteed. But if someone told me to write C++ myself, I'd cry. There's too much to memorize, and the standards are too varied. When I go to a project site for maintenance and it's a C++ project, I instantly lose energy — because it's just too difficult. I'd be happy if som…

The language is fine, mostly, nowadays. The ecosystem isn't fine - just to get a project going requires picking a non-trivial set of tools and approaches, none of which the C++ standard enforces or guides to. For example, will you manage dependencies via packages? If so, with what? What will you use for building your project? The list goes on and on.

No it's not.

The language keeps growing, with

- new features overlapping old features from previous standards without replacing them or deprecating them (function::copyable_function vs std::function, std::less key for transparent lookup in maps)

- new features not usable by the layman (coroutines ...)

- Cryptic syntax (reflection...)

- Stuff you are told not to use because of performance reason and that cant be fixed because of ABI (regex)

- Compile errors that are 1km long (no, concepts are not helping here, the 'nicer' message is still buried into a hot pile of template instantiation callstack).

Re: C++: The Documentary

#57
post #11

It's surprising that C++'s development trend continues. When a game or program is made with C++, it's usually nice because performance is mostly guaranteed. But if someone told me to write C++ myself, I'd cry. There's too much to memorize, and the standards are too varied. When I go to a project site for maintenance and it's a C++ project, I instantly lose energy — because it's just too difficult. I'd be happy if som…

For games, C++ becomes a much simpler language since game code bases usually ignore the C++ stdlib (at least mostly, and for good reasons, e.g. see [0]). And without the stdlib C++ is actually kinda-sorta okay-ish. Related, the main problem with the C++ ecosystem is that everybody carves out their own language subset, so it's not one ecosystem but many ecosystems with contradicting styles and language/stdlib subsets.…

I fully agree. In my personal project, I ended up using the STL to get off the ground, but in the end I replaced pretty much everything with custom-written code.

Once you get rid of the STL, compile times get so much better. With modern c++23 features, templates actually become really convenient to write, and at the core there is a really useful and pleasant to use language.

I try to avoid c++ libraries and instead rely on c-style APIs. Usually the c++ style libraries force you into using the STL, which comes with a heavy tax on compile times, without much benefit in comfort of use.

Re: C++: The Documentary

#59
post #31

Earlier quoted context omitted.

For games, C++ becomes a much simpler language since game code bases usually ignore the C++ stdlib (at least mostly, and for good reasons, e.g. see [0]). And without the stdlib C++ is actually kinda-sorta okay-ish. Related, the main problem with the C++ ecosystem is that everybody carves out their own language subset, so it's not one ecosystem but many ecosystems with contradicting styles and language/stdlib subsets.…

If you don't use the STL you end up re-implementing it yourself. Usually poorly.

Which is worse? std's mess or one you control? I'd take any random game engine's STL over std any day.
Post reply on HN