Live data from Hacker News

The Two Factions of C++ (2024)

herecomesthemoon.net

71–80 of 89 posts

Re: The Two Factions of C++ (2024)

#71

To be fair to the committee, upgrading C++ compilers is already a chore, even with the changes as small as they are. Would you rather spend time updating your lambdas because they changed how capture works (a real breakage not long ago), or doing something of actual value? The only reason we finally updated from Python 2.7 to 3 was that the OS vendors dropped it, but it was effectively a waste of time. That aside, I…

> Why does it matter if setting -std29 or whatever breaks ABI when -fno-rtti does the same?

I think it's the distinction between can and must. Right now you can preserve ABI across compiler versions if you want to (and that is indeed a desirable quality for some users). The pushback is against changes to the standard that would require an ABI break.

Re: The Two Factions of C++ (2024)

#72
post #70

You folks are in an HN bubble. C++ is still king of the mountain and it will remain so for decades. The billions of lines of existing C++ are not being re-written in rust (by humans or AI's). 100 thousands of lines are being re-written. C++ is changing, but C++11 is moving across the land. It will be 20 years before the 'new' C++ stuff gets regularly used. Just because it is old, doesn't mean it doesn't have value. J…

Was about to say the same thing. The amount of training code for LLM's that exists in C++ is probably orders of magnitude more than any other "challenger" languages combined. Love it or hate it C++ is here to stay.

Re: The Two Factions of C++ (2024)

#73
post #35

Earlier quoted context omitted.

Reflection is a joke. De/serializing arbitrary C++ structs is ill-defined. When you need serialization, even lots of it (e.g. silly JSON), I think you're better off writing your own framework where you can be clear about data formats and transformation rules.

Reflection is likely useful for a lot of things, but I agree serialization need a better framework.

Yes -- I can see good use for runtimes. For example, compiler can autogenerate good runtime error messages. Thinking about it, debuggers make use of reflection. Debuginfo formats have some kind of reflection built in.

Re: The Two Factions of C++ (2024)

#74
post #43

Earlier quoted context omitted.

> There is a good language buried underneath C++ somewhere Well.. "C".. though I wouldn't go so far as to call that a good language, either.

Lack of support for type-safe containers (need to be hack toghether via macros) and overreliance on macros in general (which are not IDE and debugger friendly) are two aspects of C that are off-putting for majority of people in 2026. That's even assuming you're willing to forego pointer/memory safety.

> Lack of support for type-safe containers (need to be hack toghether via macros)

Are templates really so much better than macros that the latter deserve to be called a "hack"? The following two examples are both type-safe and have roughly the same semantics and #LoC:

Macros:

  // pair.h
  struct id(pair) { T a, b; };
  static inline struct id(pair) id(make_pair)(T a, T b){
    return (struct id(pair)){ .a = a, .b = b };
  }
  #undef id
  #undef T

  // main.c
  #include 
  #define T int
  #define id(n) n ## _int
  #include "pair.h"
  int main(void){
    struct pair_int p = make_pair_int(12, 13);
    printf("%d %d\n", p.a, p.b);
  }
Templates:

  //pair.h
  template
  struct pair { T a, b; };
  template
  pair make_pair(T a, T b){
    return (pair){ .a = a, .b = b };
  }

  //main.cpp
  #include 
  #include "pair.h"
  int main(void){
    pair p = make_pair(12, 13);
    printf("%d %d\n", p.a, p.b);
  }

Re: The Two Factions of C++ (2024)

#75

Should have a (2024) annotation so far as I can see (haven't finished reading the article but it seems to be about events which have "just happened" back then) also at the time this is what HN wrote about it: https://news.ycombinator.com/item?id=42231489

Thanks! Macroexpanded:

The two factions of C++ - https://news.ycombinator.com/item?id=42231489 - Nov 2024 (653 comments)

Re: The Two Factions of C++ (2024)

#76

> “We must minimize the need to change existing code. For adoption in existing code, decades of experience has consistently shown that most customers with large code bases cannot and will not change even 1% of their lines of code in order to satisfy strictness rules, not even for safety reasons unless regulatory requirements compel them to do so.” But the major players do seem to be happy to replace their C++ code wi…

They seem willing to gradually replace C++ with Rust, but that actually does require C++ to not change in backward incompatible ways. They're depending on a stable ABI when calling into Rust.

Re: The Two Factions of C++ (2024)

#77

> “We must minimize the need to change existing code. For adoption in existing code, decades of experience has consistently shown that most customers with large code bases cannot and will not change even 1% of their lines of code in order to satisfy strictness rules, not even for safety reasons unless regulatory requirements compel them to do so.” But the major players do seem to be happy to replace their C++ code wi…

Replace C++ code with Rust is happening at a glacial pace, basically involving full rewrites of the module replaced and significant work to refactor the surrounding code to support it.

(This is why Rust is focusing heavily on interop right now, if it is easier to integrate more projects can use it)

The problem is updating a decently sized program from one version of a compiler to another can take man months to do and that doesn't typically include intentional breaking changes.

A C++ change that requires updating 1% can be several hundreds of thousands of updates which is on the scale of beyond a man year depending on if you can regex cheat.

The fear the author is glossing over (I wouldn't say ignore they acknowledge there are reasons) is when faced with a man year to update people just don't.

Especially when the most interesting breaking changes don't tend to be synthetic (you can just make modules look like code you couldn't write before after all) but instead be subtle changes in behavior.

That means that you won't necessarily even know all the breakages which is a horrifying concept.

Re: The Two Factions of C++ (2024)

#78

> “We must minimize the need to change existing code. For adoption in existing code, decades of experience has consistently shown that most customers with large code bases cannot and will not change even 1% of their lines of code in order to satisfy strictness rules, not even for safety reasons unless regulatory requirements compel them to do so.” But the major players do seem to be happy to replace their C++ code wi…

Don’t believe everything you read. Any communication from them is a PR exercise.

On the other hand, I read an interesting substack blog from an ex-Azure employee the other day: the Russinovich-dictated Rust rewrite was allegedly vaporware for a long time and caused lots of headaches that were not widely known. A highlight for me was the use of over 1000 third party crates in their products.

Would be interesting to know how it’s going nowadays.

As any company, the one I work for also has its decent share of rustafarians. The Rust penetration is modest and slow, but the PR is remarkable.

Re: The Two Factions of C++ (2024)

#79
post #51

> “We must minimize the need to change existing code. For adoption in existing code, decades of experience has consistently shown that most customers with large code bases cannot and will not change even 1% of their lines of code in order to satisfy strictness rules, not even for safety reasons unless regulatory requirements compel them to do so.” But the major players do seem to be happy to replace their C++ code wi…

> But the major players do seem to be happy to replace their C++ code with Rust. Because incremental improvements don't provide enough value. A stable C++ codebase is best left untouched. It's not worth to rewrite C++ into C++++ to get a couple of features that are flawed retrofits backported from modern languages. In the end you still have C++.

The set-up and your reply feel like a Rust sketch.

Not touching a codebase only applies to legacy software which is feature complete. Any actively developed software will benefit from incremental improvements.

Quality C++ projects continuously improve their code and tooling. It would be very convenient for the rustafarian community if the competition stood still, but that’s not the case. Quite happy to see that golang’s also providing solid opposition.

Re: The Two Factions of C++ (2024)

#80

Earlier quoted context omitted.

> But the major players do seem to be happy to replace their C++ code with Rust. I would be wary of mindlessly referring to appeals to authority like this. Sometimes their rationale is very context sensitive. For example, Microsoft has been behind quite a heavy push for C#, and it wouldn't be wise to use that as an example of C# being preferable to C++. See for example Bun's recent migration to Rust which could be mi…

> Bun's recent migration to Rust which could be misinterpreted as an example supporting migrating to rust, but under the hood it's far from a success story. Since you don't mention that this migration is basically executed agenticly by Claude, it seems like you attribute this troubled migration to Rust not being that good of an improvement after all. For me it doesn't seem that surprising that Claude autonomously tra…

> Since you don't mention that this migration is basically executed agenticly by Claude, it seems like (...)

That's immaterial to the discussion.

Post reply on HN