News for hackers. Stuff that matters.
Re:Taming the UB Monsters in C++ by dgellow on Monday March 31, 2025 @05:52AM (#43533084)
According to Herb’s article most of this is already available in compilers
Re:Taming the UB Monsters in C++ by pjmlp on Monday March 31, 2025 @07:03AM (#43533538)
Partially.
Re:Taming the UB Monsters in C++ by AlotOfReading on Monday March 31, 2025 @10:02AM (#43535195)
In mainstream compilers. Most of these options aren't available in compilers e.g. for safety critical code.
Re:Taming the UB Monsters in C++ by steveklabnik on Monday March 31, 2025 @11:39AM (#43536296)
Depending on how you look at it, that raises the question of "if this is so effective, and it's already available, why hasn't the situation improved?"
Re:Taming the UB Monsters in C++ by pjmlp on Tuesday April 01, 2025 @07:24AM (#43545453)
As many of us point out, even those that actually apreciate C++ despite its warts, safety culture or lack thereof.

Which I think it was much better back when it was C++ vs C in the C++ARM days, with great compiler provided frameworks, eventually past C++98 there seems to have been an inversion, as C++ graduality took over domains where C ruled.

The same mideset that will reach out for unsafe language constructs, regardless of the programming language, without any kind of profiler information, because of course it is faster and every μs counts.

Re:Taming the UB Monsters in C++ by Wumpnot on Tuesday April 01, 2025 @07:35AM (#43545538)

  1. who says it hasn't?
  2. most of the vul code is C, which is obviously much harder to harden, and the Rust Evangelism Strike Force loves to pretend that C++ is the same as C, so no matter the improvements to C++, they will just point at C.
  3. I think many simply didn't know about these hardening modes, MSVC has had this for 10-15 years, but I still encounter people who don't know about it..somehow.
Re:Taming the UB Monsters in C++ by steveklabnik on Tuesday April 01, 2025 @11:45AM (#43548183)
It hasn’t enough to satisfy industry or regulators.

As long as that C code is valid C++ code, it’s still a problem for C++. Backwards compatibility with C is a strength, but also a weakness. The Go and Java folks invested in rewriting dependencies in their own language to prevent problems, if C++ is truly that much safer than C, the C++ community could do the same, and demonstrate that it’s safer.

This is the power of opt out vs opt in. You can’t forget to run the borrow checker in Rust. That’s a practical, real-world advantage.