News for hackers. Stuff that matters.
Re:C++23: Removing garbage collection support by no_wizard on Wednesday November 01, 2023 @10:30AM (#38098650)
Is it not possible to use a linter with C++ that can tell you when you have done X or Y incorrectly?

surely, there is tooling that can help right?

Re:C++23: Removing garbage collection support by thesuperbigfrog on Wednesday November 01, 2023 @10:36AM (#38098752)
It is possible to use C++ with a linter to help detect errors, but linters do not catch all errors nor do linters always understand what you are trying to.

Most approaches to using C or C++ safely involve throwing out large portions of the language and disallowing features that are easy to misuse or problematic to analyze for safety.

Re:C++23: Removing garbage collection support by foooorsyth on Wednesday November 01, 2023 @10:46AM (#38098884)
Not all of the issues you can create in C++ are visible at compile time. That’s kind of the point.

A lot of the time you’re going to need to lean on Valgrind. And that’s AFTER you shipped a fatal crash and you’re parsing a tombstone.

Re:C++23: Removing garbage collection support by UncleMeat on Wednesday November 01, 2023 @11:14AM (#38099341)
Often no, for multiple reasons.

Separate compilation means that even if you write an interprocedural static analysis system (quite a bit more complex than what most people would call a linter), you still run into oodles of hard boundaries where you can't look into other functions. Fixing this requires explicit annotations all over the place to even have a chance.

C++ is also a remarkably complex language in terms of aliasing relationships. There are a bazillion ways you can make two names alias each other. This gives you a few options when writing an analysis. You can be sound and do weak updates everywhere, which means your alarms will basically never be confident. You can be unsound and assume no aliasing, which means that you've got a lot of false alarms. You also can't really make a rule "don't ever create aliasing relationships" because they are often idiomatic C++.

And finally, the key properties that people really deeply care about like heap lifetimes fundamentally involve complex reasoning about both temporal properties, dataflow, and heap shape. All of these are hairy static analysis problems. In combination, a nightmare.

Re:C++23: Removing garbage collection support by ReactiveJelly on Saturday November 04, 2023 @03:44AM (#38138963)
Maybe. But my employer doesn't have those tools. Assuming we're a median team, then half of all c++ teams don't do any static analysis or even know how to use valgrind properly. (The only tools that looked useful to me were the ones that incurred a thousand x slowdown, and our code is too crappy to run correctly at different speeds)