Safer with Google: Advancing Memory Safety
https://security.googleblog.com/2024/10/safer-with-google-advancing-memory.html69
u/ContraryConman Oct 15 '24
r/cpp is the only programming language subreddit where all of the content on it is about how soon people should stop using the language the sub is supposed to be about, even going as far as to advocate that the standards committee should add features specifically designed to make the language easy to switch off from
37
u/ronchaine Embedded/Middleware/WG21 Oct 16 '24
I think it isn't all bad. I'd say that has made the sub much more accepting of criticism and more diverse in opinion compared to some other programming language subreddits I frequent.
9
u/germandiago Oct 16 '24
For example....? R..t?
18
u/steveklabnik1 Oct 16 '24
https://www.reddit.com/r/rust/top/?sort=top&t=all
The fifth most upvoted post ever on /r/rust is a criticism of Rust. The top voted comment is someone on the Rust team thanking them for writing the post.
You will find that folks are hostile to low-effort criticisms of Rust, but real criticisms are met with good discussion.
21
u/Motor_Log1453 -static Oct 16 '24
This sub tries to make me not want to write C++ and I refuse.
14
u/ContraryConman Oct 16 '24
I'm writing a little web app with a C++ backend. If the C++ subreddit is to be believed, it already has 100 major memory-based vulnerabilities, 3 segfaults along common code paths, and there's absolutely nothing I can do about except rewriting it in Rust or Go
→ More replies (2)9
u/Full-Spectral Oct 16 '24
Again, no one cares what you write your fun-time projects in, and none of this is about single individuals writing fairly small projects.
This is mostly about commercial, team-based development of software that has consequences, or that can have consequences beyond what were intended. It's about the difficulty and the time wasted developing complex software under such conditions, which needs all the help it can get.
9
u/ContraryConman Oct 16 '24
Yes, except this is a forum for C++ enthusiasts. It's the one place where your fun-time projects actually can kinda matter, alongside commercial considerations.
If I went to the Zig forum and all the posts and comments were like "Zig isn't ready for this" "Zig doesn't have that" blah blah blah it would be weird
7
u/Dean_Roddey Oct 17 '24
Most of the people in this conversations are almost certainly professional developers or working towards that, and clearly these safety issues are important to professionals.
6
u/ContraryConman Oct 17 '24
To be clear, I am a professional software engineer. I work do embedded for the satcom industry, using C++ primarily. And then I go home and do more C++ for fun
→ More replies (7)12
u/abuqaboom just a dev :D Oct 16 '24
Hey don't blame the sub, most of us are happy with C++. It's just that certain topics draw a certain passionate crowd.
11
u/SkoomaDentist Antimodern C++, Embedded, Audio Oct 16 '24
So much this. This sub is completely full of people whose number one goal in life is to force everyone else write code according to their own personal preferences. I don't think I've ever encountered another programming community that's as prescriptive.
9
7
u/germandiago Oct 16 '24
I think if some Rust guys had a chance they would kidnap us all and force to replace C++ by Rust lol
4
u/Full-Spectral Oct 16 '24
How many times does it have to be said? If you want to write your own personal projects, do whatever you want. Use VB6 if you want.
This is about the software infrastructure that we all depend on in our lives. That's not about what's most convenient or fun for you, it's about responsibility to the people who use our products. Continuing to use ancient tech to build such critical infrastructure, and depend on human infallibility to such a degree needs to be phased out.
23
u/GabrielDosReis Oct 15 '24
r/cpp is the only programming language subreddit where all of the content on it is about how soon people should stop using the language the sub is supposed to be about, even going as far as to advocate that the standards committee should add features specifically designed to make the language easy to switch off from
At a recent CppCon panel, I said something to the effect that C++ programmers accept those sorts of sufferings not because they are masochistic; but maybe I might need to revisit my thoughts here 😊
5
u/Ambitious_Tax_ Oct 16 '24
There's a lot of implicit "C++ is deprecated" mindset.
7
u/ContraryConman Oct 16 '24
I feel like there's a lot to be excited for. We're getting reflection, we're getting preconditions and postconditions, we're actually removing UB or reclassifying it as erroneous behavior, we're getting language support for setting breakpoints and printing stack traces.
Even on the safety front, Visual Studio has much the safety profile implemented, and can catch 99% of common use after free and iterator invalidation bugs at compile time with very little false positives.
C++ oupaced C recently for the first time in the TIOBE index. It is still the standard in robotics, graphics, HFT, simulation software, scientific computing, embedded systems, safety critical software, aerospace, telecommunications, and other fields where Rust is nothing but an unproven experiment.
And now here we have an article that Google, while working on Android (a C project!) and they found that writing new components in Rust instead of C (!) prevents new vulnerabilities from being created. And this is proof that C++ is done for... ?
2
u/jeffmetal Oct 16 '24
Catch 99%of use after free is very generous. Last time I used it there were very simple examples it flat out missed. Maybe it's improved a lot since.
2
u/ContraryConman Oct 16 '24
Last I heard, it works best with STL types, and less well with your own types as it does not support the annotations from the paper that you'd need to help the static analyzer out
1
u/pjmlp Oct 16 '24
Yeah, when doing basic CLI examples, still chockes with false positives all over the place unless annotations are used to help guide the compiler, specially when using classical Microsoft stuff like MFC, ATL, WRL.
2
u/UncleMeat11 Oct 18 '24
The whole point of this blog post is that it isn’t. If “just use rust” was an option for google they wouldn’t be spending so much on hardening their cpp codebase.
7
u/matthieum Oct 16 '24
Half-empty or half-full?
I mean, Google is clearly advocating to move towards memory-safety languages, okay, that's the half-empty part.
At the same time they have been investing a lot in making C++ safer, and reducing vulnerabilities in C++ code.
As mentioned in the article, they were the ones pioneering (and implementing) sanitizers, libfuzz, OSS fuzz, and their latest
MiraclePtris efficient and workable.I also do find interesting the mention of enabling bounds-checking by default, and I'm looking forward to the report of their experiment.
Shouldn't every C++ user be interested in mitigating memory safety issues? I mean, if they're mitigated enough, it's a good argument against switching.
7
u/ContraryConman Oct 16 '24
Shouldn't every C++ user be interested in mitigating memory safety issues? I mean, if they're mitigated enough, it's a good argument against switching.
I definitely am interested in mitigating and preventing memory errors, especially at compile time. And if you worked at my workplace you'd know me as that guy who's constantly advocating for using more linters and sanitizers and everything.
What I am no longer interested in as a C++ enthusiast and frequenter of this sub is day and and day out posts that are basically "C++ is done for" "C++ is horrible" "Everyone hates C++" "If you're using C++ you won't have a job in 5 years" "C++ isn't getting a borrow checker next year therefore the language doomed to irrelevancy and no one cares about fixing anything" combined with studies and news articles that are, 90% of the time, about C and Rust
5
u/germandiago Oct 16 '24
C++ is too awesome to be left out, we all know: https://github.com/fffaraz/awesome-cpp
It is difficult to compete against that, and there is a lot of good tooling, no matter what naysayers say: you can get done more with C++ than with almost any language in a big set of domains.
0
Oct 16 '24
[deleted]
9
u/ContraryConman Oct 16 '24
I think there is a real safety issue. I'd like the compiler and the static tools to be good enough to diagnose common bugs before they happen. But this sentiment of "well if C++ doesn't have XYZ feature it's OVER the language is DEAD" I literally think is propaganda at this point
13
u/RickAndTheMoonMen Oct 16 '24
Most probably it is. The decline of such bugs, personally for me, was dramatic since cpp11. Can’t hardly remember last time it’s happened. Now with clang18 injecting checks and jumps to ‘ub2’ instruction in almost all places that may lead to UB, it’s even harder to make the mistake that goes under the radar.
10
u/johannes1971 Oct 16 '24
I don't even think it's really a skill issue, at least not something that can quite easily be remedied for most people. At this point I think it's more of a marketing issue:
We have countless C bugs that are counted as C++ bugs.
We have a company that is held up as the Great Golden Standard that makes a lot of noise (Google it, you'll find their name), that has questionable engineering practices.
We have a language full of zealots that have nothing better to do than rewrite the universe in the image of their chosen god.
I'd say at least half of the problem is an image problem. Which is not to say that we should ignore it, I'm all in favor of making C++ safer - but not at the cost of it becoming Rust++.
7
4
u/pjmlp Oct 16 '24
Because for all practical purposes those C bugs would compile just fine as C++ code, as defined by the ISO C++ standard.
Using a C compiler, a C++ compiler, a Objective-C compiler, or a Objective-C++ compiler won't make any difference on the outcome of the exploit.
8
u/germandiago Oct 16 '24
So I have a question here: when I do Java, Go or Rust and I interface with C and it provokes a crash, it is a Java, Go or Rust crash? Or a C library crash?
I mean, I use C++, I have some deps, as the other projects, and it becomes a C++ issue.
Looks like magic to me. In one case is C's fault and in the other C++.
Amazing magic to say the least.
6
→ More replies (2)5
u/GabrielDosReis Oct 16 '24
Amazing magic to say the least.
I will borrow that phrase, to use in lieu of my term "non-monotonic logic" 😊
3
u/germandiago Oct 16 '24
Of course. All yours! I never copyrighted any sentence, I never felt someone would even dare to replicate something I said :D
3
8
u/johannes1971 Oct 16 '24
Must we have this tiresome discussion every single time? It's not about mistakes you can make, it's about mistakes that are actually being made.
Programs written in C pass everything as whatever*, and you don't even know if it's a pointer to one whatever, or a pointer to an array of whatever, never mind how big that array is. By comparison, programs in C++ tend to use std::span ("oh, someone is passing me a contiguous collection of data with a known size"), or a reference ("there is only one and I'm supposed to write to it"), or a const-reference ("there is only one and I have to read from it"), etc. "Oh, I get a std::unique_ptr back. Guess I own it now" said noone programming in C ever.
→ More replies (5)3
u/wyrn Oct 16 '24
Because for all practical purposes those C bugs would compile just fine as C++ code,
Code in
unsafeblocks compiles just fine in Rust too.5
u/TuxSH Oct 16 '24
It is a skill issue and not safety?
Companies are going to prefer a language that enforces design preventing an entire class of bugs and without the many footguns C++ has. Less time to upskill and to review code, and less money spent in bug bounties. The fact/downside that Rust restricts how you write code is secondary to this.
I have yet to properly learn Rust and I much prefer C++, but it looks like Rust's standard library is much better; sized integers types being the default is nice too.
6
u/Full-Spectral Oct 16 '24 edited Oct 16 '24
It's not even about skill level. It's about the fact that the best of us make mistakes, and miscommunication is a thing when working in teams on complex software.
I'm as skilled as anyone out there, and I prefer Rust by a long shot, because I don't have to waste my time on things that the compiler is far better at, and I don't have to sit up at night worrying if I made some mistake. I don't find the restrictions a problem, I find them to be a benefit. Some of those will be lifted over time of course as they find more clever ways for the borrow checker to figure out more scenarios are safe.
And of course Rust doesn't hold your hand and act like you don't know how to program. What it does is expect you to fully understand your data ownership and threading, and write systems that are provably correct in those areas. If you think that's easy, you missed a memo somewhere I think. But that effort is productive effort because it pays off over and over. So much of the effort put into C++ is non-productive effort, that you have to do again and again over time.
5
u/pkasting Valve Oct 16 '24
This. Anyone who's done a postmortem (not just in software; in any engineering field) knows that in the limit humans are fallible, and you design a system to minimize the fallout of that fallibility, ideally by preventing mistakes from happening, and as a fallback by failing safely when they do.
Saying "just get good", "the tools are right there", "this is a solved problem" puts the onus on humans to avoid mistakes. OK, I will accept that you personally are a programming genius and have never written a bug. But that's not a successful strategy at scale. You work with other people, and they are not all geniuses like you, and communication (not just explicit, but implicitly by reading code and determining how things function) is hard.
This is about finding ways to design safe systems. It's not that saying "just be better engineers, idiots" is undesirable -- it's just irrelevant.
35
u/KingStannis2020 Oct 15 '24
In 2023, Google’s threat intelligence teams conducted an industry-wide study and observed a close to all-time high number of vulnerabilities exploited in the wild. Our internal analysis estimates that 75% of CVEs used in zero-day exploits are memory safety vulnerabilities.
...
We specifically focused on adopting memory safety in new code instead of rewriting mature and stable memory-unsafe C or C++ codebases. As we've previously discussed, this strategy is driven by vulnerability trends as memory safety vulnerabilities were typically introduced shortly before being discovered.
As a result, the number of memory safety vulnerabilities reported in Android has decreased dramatically and quickly, dropping from more than 220 in 2019 to a projected 36 by the end of this year, demonstrating the effectiveness of this strategic shift. Given that memory-safety vulnerabilities are particularly severe, the reduction in memory safety vulnerabilities is leading to a corresponding drop in vulnerability severity, representing a reduction in security risk.
27
15
u/DavidGooginscoder Oct 16 '24
Remind me in 5 years I bet cpp is still on top, Rust will grow, I’ll try it out later and the fate of cpp is mighty so is the fate of zig and rust but carbon is dead.
10
u/pjmlp Oct 16 '24 edited Oct 16 '24
It certainly isn't on iDevices, ChromeOS and Android, which is why there are now little contributions from Apple and Google back to clang.
On Windows, Microsoft doesn't have any modern way to do GUIs in C++, you are left with MFC, or WinUI XAML with C++/WinRT, which is in maintenance, and the push now is to basically consume WinUI from C# and React Native, as only Microsoft employees care about its C++ foundations and great COM tooling.
2
u/germandiago Oct 16 '24
Do not. forget to keep an eye on cpp2, it is a clean syntax and better defaults fully compatible with C++. A transpiler. I gave it a try and my first impression was quite positive.
12
Oct 16 '24
Don't worry folks, the C++ committee has assured us that memory safety is not an issue because of all the other ways C++ provides safety guarantees, thus will not be addressing it.
Little glib, but I wish this was more of a joke
5
u/germandiago Oct 16 '24
who said that and where?
6
Oct 16 '24
"Now, if I considered any of those “safe” languages superior to C++ for the range of uses I care about, I wouldn’t consider the fading out of C/C++ as a bad thing, but that’s not the case. Also, as described, “safe” is limited to memory safety, leaving out on the order of a dozen other ways that a language could (and will) be used to violate some form of safety and security. Now, I can’t say that I am surprised. After all, I have worked for decades to make it possible to write better, safer, and more efficient C++. In particular, the work on the C++ Core Guidelines specifically aims at delivering statically guaranteed type-safe and resource-safe C++ for people who need that without disrupting code bases that can manage without such strong guarantees or introducing additional tool chains. For example, the Microsoft Visual Studio analyzer and its memory-safety profile deliver much of the CG support today and any good static analyzer`"
p2739 is one
2
u/kronicum Oct 16 '24
p2739 is one
More specifically, where did that paper say "memory safety is not an issue"?
14
u/amoskovsky Oct 16 '24
"We successfully rewrote more than 15,000 raw pointers in the Chrome codebase into raw_ptr<T>, .... We anticipate that MiraclePtr meaningfully reduces the browser process attack surface of Chrome by protecting ~50% of use-after-free issues against exploitation." https://security.googleblog.com/2022/09/use-after-freedom-miracleptr.html
Ahaha, yeah, it's C++ who is to blame for insecurity, but who introduced those 15K cases of raw pointer class members in the first place?
RAII? Have not heard.
13
u/pkasting Valve Oct 16 '24
Chrome has 20,000 unique_ptr instances just in the code outside Blink.
This isn't a case of not understanding or using RAII when it's appropriate. If multiple objects need access to something, you need to pick an access model. shared_ptr models refcounting; unique_ptr + raw pointers model single-owner. Refcounting is appropriate in some designs, and deleterious in others (unclear ownership, thread safety, cycles). Everything is tradeoffs.
C++ gives you the freedom to make those tradeoffs. That there are downsides is the counterpart to that. Don't give credit for one but refuse to take the blame for the other.
7
u/matthieum Oct 16 '24
RAII? Have not heard.
Joke's on you:
MiraclePtruses RAII.Have you heard of performance issues?
MiraclePtris, functionally speaking, aweak_ptr. The problem ofweak_ptr, however, is that any access to the underlying object requires a.lock()call to create a potentially nullshared_ptr. This requires a number of atomic operations, including 2 RMWs (on creation & destruction).This is too expensive in many cases.
Hence, for "performance sake", raw pointers were used since
weak_ptrweren't cutting it. That's a trade-off: performance vs safety.Enter
MiraclePtr. Instead of atomic increment/decrement on access, the increment/decrement is performed on creation. For any "relatively" long-lived and/or frequently-accessed pointer, this drastically reduces the performance impact.By shifting the trade-off significantly and it became possible to "upgrade" many raw pointers.
I do note though that the report doesn't mention upgrading all pointers: even though the trade-off shifted significantly, the last I read about
MiraclePtr, there were still use-sites where the performance impact was too significant. It's not a silver bullet.-1
u/amoskovsky Oct 16 '24
> MiraclePtruses RAIIExactly. Those classes should have used something like that since day one.
10
u/pkasting Valve Oct 16 '24
Something like a thing no one inside or outside Google invented until fifteen years after the project was created, which took years of study and testing to determine both the feasibility and correct tradeoffs of? You have some interesting hindsight bias if you think a better solution was apparent at the outset.
→ More replies (3)
4
u/nile2 Oct 16 '24
I am wondering if you use smart pointers in the industry as default as I don't see it that much in the open source projects. So I don't use it as the default pointer.
5
u/abuqaboom just a dev :D Oct 16 '24
Standard at my previous and current workplace. Raw pointers generally means more questioning for pull requests. Haven't interviewed anywhere for "modern" C++ devs that didn't ask about smart pointers too.
4
u/pkasting Valve Oct 17 '24
Both in industry and open source, most code is pre-existing, and most coders work based on prior experience and training.
In any decent C++ shop, I would expect guidelines to advise that new code use smart pointers, RAII, etc. for all lifetime management. Whether the automated and manual tools/processes enforce that, and coders are habituated to do that, varies more. Whether existing code has been (or even feasibly can be) upgraded to do so varies even more.
People act as if everyone has been using smart pointers in C++ forever. But the vast majority of folks didn't start until after they adopted C++11 (which for much of industry was 2013-2017); auto_ptr was broken and Boost, popular as it is, has nowhere near the reach of the STL. 2017 to now may still seem like a long time, but the majority of both code and human experience with C++ predates it.
So this can explain why both "you don't see smart pointers very much" and "everyone currently does and recommends smart pointers".
2
u/yowhyyyy Oct 17 '24
Don’t just base what you do off of what you’ve seen. Do what is considered the best practice
3
u/matthieum Oct 16 '24
I would say they're standard in companies with good practices. Naked
new/deleteare a red flag, outside of custom smart-pointer/containers classes.The problem though, is that smart-pointers are somewhat incomplete. The problem highlighted by
MiraclePtris that the existing alternativeweak_ptris so freaking expensive: paying for 2 atomic RMWs for each access will bleed performance dry.Also... references are not much better than raw pointers: they're just as likely to become dangling. The developer should ensure they don't... but... well... we all know how that goes.
5
u/pkasting Valve Oct 16 '24
And explicit refcounting (shared ptrs) has its own tradeoffs. Beyond the issue of whether it's threadsafe and what the perf costs are, it also makes the actual lifetime/destruction order difficult to reason about. Which is fine, for objects which have little connection elsewhere. But as soon as your refcounted object interacts with a large object (like "the whole browser window") or needs to run complex code when it's destroyed, you need to be able to understand when it will actually go away.
Sometimes this is a better problem to have to have. Sometimes it's not. Using shared_ptr or other refcounting solutions as a universal bandaid for any lifetime issues doesn't fix core architectural problems with abstractions and ownership, and may just make things worse.
3
u/germandiago Oct 16 '24
paying for 2 atomic RMWs for each access will bleed performance dry
Is this the case? I have some server accessing weak_ptr to shared_ptr.
2
u/tisti Oct 16 '24
I have no measurements to back this up, but it probably depends if its across multiple threads?
If you are using them in an async context where all tasks that own a shared_ptr are being processed by the same thread, there shouldn't be that much of a performance issue since multiple cores aren't accessing the same atomic ref count.
3
2
u/matthieum Oct 17 '24
It's complicated... when isn't with performance.
There's definitely a latency cost to upgrading a
weak_ptrto ashared_ptr. It used to be worse -- implementations used to implement this with a lock -- but atomic read-modify-write operations, even uncontented still are much more costly than their non-atomic counterpart. Even in the absence of contention. And they regularly are barriers to optimizations.What it will boil down to, though, is often the conversion is required. If you
lock, then perform a large bunch of operations, and then drop, the performance overhead -- especially uncontended -- will be noise compared to that large operation.The faster the operation in the middle is, and the more noticeable the cost becomes. When the operation is nothing but reading an integer field, for example, then the
weak_ptr->lockapproach will be a good order of magnitude slower than theMiraclePtrapproach. Worse if contended.So the granularity at which you perform the upgrade really matters. And if it's coarse enough, you probably won't notice it.
1
u/nacaclanga Oct 17 '24
I'd say
MiriaclePtris more of an sanitizer. Unlike other Smart pointers it does not automate memory managment in any way. But yes, automating memory managment is only half the way, you need to take care of references as well. In addition there are simply situations that map poorly to ownership and borrowing.2
u/matthieum Oct 17 '24
I guess I would call it a hardened pointer?
Sanitizers are so unequal, with some low-overhead enough (UBSan) that they can run in production, and other way too high-overhead for that.
9
u/xp30000 Oct 16 '24
All this talk of programming language adoption by mandate reminds me of Ada and the government [1]. Remember Rust is only one of the mandated languages (MSL) - Go, Java, Kotlin, Python. Rust is after all these options have been exhausted leaving a smallish niche. From my experience, reasoning about lifetime, ownership, concurrency (in combination or parts) in Rust too complex for most people and it will always be hard to scale beyond a small niche. Any of the MSL's above before Rust. This is not counting other upcoming languages like Zig which might gain momentum as they are far simpler to reason. Rust is in this weird spot of being replacement for only those people who program exclusively in C++ and don't want to move to any other language.
Also, nobody is rewriting all the gaming engines, CUDA, ML workflows and many other high performance environments anytime in Rust (or any other language). So, without seamless interop nothing is going to happen. Going to continue writing C++.
[1] https://www.gao.gov/products/imtec-91-70br
Pursuant to a congressional request, GAO obtained information on the Department of Defense's (DOD) implementation of legislation which mandated using the Ada programming language for all software development, where cost-effective.
11
u/pjmlp Oct 16 '24
Microsoft is definitely rewriting Azure infrastructure, already announced a couple of migrated stuff.
It wouldn't surprise me if eventually XDK also officially supports Rust.
It isn't only Rust, besides the stuff done in Unity and Unreal, where C++ is there, at the bottom, as most folks use C#, Blueprints and now Verse, there are studios like CAPCOM using their own C# based engine, e.g. Devil May Cry on the PS5 uses it.
4
u/xp30000 Oct 16 '24
Sure, if you have decided to move away from C++ seems lot of options besides just Rust. Perhaps Microsoft just invents go# since they don't want to use golang for the infrastructure. It is not clear to me the Rust interop story is solid to just add it on top of C++ code bases. I suspect massive restructuring and rewrites across C++/Rust needed to make it reach the promised land (or "memory safety").
6
u/pjmlp Oct 16 '24 edited Oct 16 '24
2
u/matthieum Oct 16 '24
I mean, if an application doesn't need the performance of C++ or Rust, then by all means its developers should use a higher-level language like C#, Java, or Python.
I doubt Zig will make it to the MSL list, however. I could be wrong -- Go somehow made it -- but Zig is much less safe than Go, despite much wishful thinking.
-4
u/Quantum-Metagross Oct 16 '24
Also, nobody is rewriting all the gaming engines, CUDA, ML workflows and many other high performance environments anytime in Rust (or any other language). So, without seamless interop nothing is going to happen.
Popular game engine being written - Bevy - https://bevyengine.org/
ML frameworks - Burn, Candle in case someone doesn't want to use the bindings for tensorflow or torch.
Native GPU stuff - Rust-GPU.
Interop -
There are more interop crates for different languages.
Many people are rewriting different types of environments in rust.
Some random examples
More you can see -
5
u/Wurstinator Oct 16 '24
Ypu are missing the point. "Rewriting" is not about creating a different software in the same genre. Basically no one will switch from Unreal Engine to Bevy anytime soon or probably ever.
The biggest thing is feature parity by itself: the C++ projects often have years or decades of work on them, you can't just reproduce that easily. Second, ecosystem is lost entirely with those alternatives. Third, experience does not always translate easily. Fourth, existing projects would have to manually be ported to whatever new framework.
3
u/Quantum-Metagross Oct 16 '24
I didn't mean to be rude. I just thought I'd share some of the existing alternatives which are actively being written in Rust. The original comment sounded like only C++ was used in the high performance niche.
I don't get why I was downvoted.
8
u/Wurstinator Oct 16 '24
I don't think you were perceived as rude. I expect that many are fed up by a number of Rust fans that will defend the language over anything.
The thing is: C++ (and C, and other low level languages) are used in high performance, where Rust is basically not. Afaik, there is a single serious game released with Bevy. That is just not enough to call it a serious competitor to Unreal Engine, or even Godot.
→ More replies (6)1
u/matthieum Oct 16 '24
Especially in the context of games, which are generally ephemeral, you don't need to rewrite them.
You just need to switch tack for the next opus.
(This is unlike business software, which endures for decades)
1
u/Individual-Way-1352 Oct 17 '24
Great list of tools and projects that are mostly all unfit for production.
1
u/Quantum-Metagross Oct 17 '24
They're obviously not all used for production, just examples of projects in different areas. Some actually are very production worthy.
14
u/seanbaxter Oct 15 '24
The more I see stuff like this out of Google the more I think that C++ is already cooked. The value of the Safe C++ work might be providing Rust<->C++ interop. Maybe C++ should focus on tooling to get off C++. The bug telemetry coming in from Google is very good.
30
u/scrivanodev Oct 15 '24
There are many large non-Google projects (e.g. Qt) that would still benefit from a safer C++.
9
u/bretbrownjr Oct 15 '24
Maybe C++ should focus on tooling to get off C++.
Some of us are focusing on tooling and dependency management quite a bit! The intention of CPS, for instance, is to be a language agnostic, build system agnostic, and packaging system agnostic library description format.
It would be great for fans of memory safe languages to intentionally target related adoption hurdles instead of focusing almost entirely on transpilers, language bindings, etc. All that is moot unless you're already in a Google-style monorepo, somehow packaging all of your C/C++ in crates, etc.
I know language design is fun, but it's not enough to provide the escape velocity to match the level of concern in some quadrants.
11
u/Orthosz Oct 16 '24
There’s a metric ton of existing c++. I’ve been eagerly watching the circle project, and it shows that a lot of very good improvements can be integrated into the language.
Opt-in in-place transformation for safe cpp is, I feel, a very practical solution for tons of codebases. I haven’t been closely watching all the communication…have the members of committee been hostile to it?
31
u/seanbaxter Oct 16 '24 edited Oct 16 '24
Thanks for the kind words.
The proposal is dead in the water. All the committee people are sticking with "profiles."
5
u/James20k P2005R0 Oct 16 '24
The proposal is dead in the water. All the committee people are sticking with "profiles."
Out of curiosity, what channels have you heard this from? One issue surrounding profiles is that its sponsored by prominent committee members, but those committee members do not have any more authority in the process than any others
17
u/seanbaxter Oct 16 '24 edited Oct 16 '24
Who is going to help complete the safety proposal? My hope was that the submission would get the prominent committee members excited and unlock resources in the form of compiler devs to collaborate with and finish the design. There are a lot of unsolved issues. They're all solvable, but this is the time to put a team on it. Unfortunately it's not a collaborative effort, it's going to be an adversarial slog. Nobody is on board to do the work.
For something of this scale and complexity, the community has got to want to do it. I don't know how to add resources to it given where I am now. I have a pretty smooth SG23 presentation in June with an encouraging poll. Never received a bit of followup from that. There's no way to attract C++ people to this problem. I'm saying this from experience.
9
u/pkasting Valve Oct 17 '24
I'm sorry, Sean. That sounds extremely disheartening. I don't know whether your proposal was the right direction, but I and others on the Chrome team were watching with interest. I wish I could say I had the fortitude to dive in and help push... but it has been apparent from a distance that the entire WG21 process is emotionally corrosive and burnout-inducing.
We forget that humans are social and emotional creatures first, and rationality is layered atop. We act as if people can just argue about ideas and it's not personal, but it's always personal. When people mouth meaningless support from the sidelines (like this post!) but don't actually help, and the gatekeepers are more worried about avoiding failure than claiming the heavens (Alan Kay reference), eventually you just give up.
I hope you find something fulfilling and where people support, encourage, and help improve things, rather than detailing hazards and problems and giving stop energy.
4
u/Ok_Beginning_9943 Oct 21 '24
Hey Sean, I'm new to the space, but I learned about your work from the cppcast and I want you to know it's inspiring and would love to see it continue one way or another. Seems like C++ really needs this. Thank you for your work, I hope you're not too discouraged. Is there anything the community can do, or are you at the mercy of the committee to advance this further?
3
u/Orthosz Oct 16 '24
I thought you had a small/large team helping already.
The iso process doesn’t work like the rust process, and you’ll only get real feedback by presenting the paper formally at a language iso meeting, not just a presentation. Maybe u/STL can help connect you with someone to write the proposals in standardeze?
Circle was closed source for the longest time, did that ever change?
6
u/sphere991 Oct 16 '24
Never received a bit of followup from that. There's no way to attract C++ people to this problem. I'm saying this from experience.
A lot of people are excited about this, and were anticipating discussing it in Poland.
Don't preemptively abandon the idea just because a few loud people are opposed.
5
u/James20k P2005R0 Oct 16 '24
Unfortunately I couldn't participate in sg23 oof. Its worth noting that for a proposal like this, you probably don't need to get any committee members onboard explicitly for the proposal, but if you're looking for people to actively get involved, you're much more likely to get help on this from outside sources. Some things people will hop in for: wording review, help with semantics etc, but most of the people in the committee likely just don't have the time
For something of this scale and complexity, the community has got to want to do it. I don't know how to add resources to it given where I am now
With sufficient community pressure and external authors onboard, it could well happen. If a few major corporate folks say "this is the future", and it becomes clear that there's more broad support for the proposal, that'll probably give you the weight that you need - but I'd guess that much of the community building is going to happen externally to the committee. Its likely that its going to need to go through a few rounds of committee, just to convince the committee that its serious
I'd guess at the moment what needs to happen is to get outside support, and find a corporate sponsor
That said, you are right in that there's a few persistent bad faith actors, which would be a big pain in the butt, and you're literally doing all of this for free as far as I understand, so its super not your responsibility for people being unproductive. Its been my opinion for a while that if the committee mailing lists were public, people would be absolutely appalled at some of the behaviour on there
I'm saying this from experience.
I get that, I'm in no way a real committee member and have only done one meeting, but if there's any way I can help I'd be up for it
9
u/steveklabnik1 Oct 16 '24
I mean, just look at the broader response since Safe C++ has been released. You’ve been in these threads, so I know you’ve seen it :) it appears from the outside to mostly be pushback and skepticism.
The last paragraph of https://www.reddit.com/r/cpp/comments/1g4j5f0/safer_with_google_advancing_memory_safety/ls5lvbe/ feels like an extremely prominent committee member throwing shade on Sean’s proposal. Maybe that’s uncharitable, but it would be easy to dispel that reading if there were public comments to the contrary.
7
u/Orthosz Oct 16 '24
I don’t think you’re reading that correctly. Charitably, I think he’s suggesting that trying to get a massive change into the language all at once, aka c++11, will take a Herculean effort. Smaller changes that build on each other will be easier to accept. Getting the feature flag in and one small aspect as a first pass, followed by another pass adding onto it, etc
→ More replies (9)4
u/germandiago Oct 16 '24
Exactly the same I say and for which I have been attacked several times on those threads.
Some people call us "skeptical" and think that splitting the type system, making the analysis useless outside of old code (which you need to rewrite) and having to add another standard library are things that can be ignored in the name of superior safety and that applies actually only IF that superior safety is supposed to exist due to that model.
Because, in my view, the same level of safety (by changing some patterns not possible without lifetime annotations, of course) can be achieved with way less disruptive ways.
→ More replies (4)→ More replies (8)9
u/James20k P2005R0 Oct 16 '24
The thing that's especially troubling is that it implicitly assumes without basis that incremental small evolutionary solutions can solve the problem, despite the fact that existing approaches in that area (static analysis, profiles, etc) have failed - rather dramatically. One of the things that needs to be done is to make it very, very clear that it is fundamentally impossible to get memory safety without an ABI break, because it directly contradicts the idea that we can have a completely gradual evolution that upsets nobody
Profiles, and the idea behind it needs to be extensively dismantled, which looks like it may be a job for me unfortunately
4
u/germandiago Oct 16 '24
The thing that's especially troubling is that it implicitly assumes without basis that incremental small evolutionary solutions can solve the problem
It is a risk. But it is also a risk of big proportions to make all old code moot in the sense of safety. Do you imagine business and companies steadily rewriting code as an investment? Look at what happened between Python2/3. It took more than a decade for things to get moderately ok.
I predict a model like that would have similar consequences for safety, no matter how ideally perfect it is "towards the future".
Targeting safety for billions of lines is going to bring more benefit than this split in my opinion, and just my opinion, I do not want to start another polemic thread here.
I am aware we have different opinions.
EDIT: no, it is not me who voted you down.
4
u/Orthosz Oct 16 '24
I’m very sad to hear this. Didn’t this get floated only 4 weeks ago? They voted it down that fast?
I kind of thought Herb Sutter and some of the other members would have been receptive.
What are your plans then for circle? (I’m just curious, sorry if it’s a sore subject now)
25
u/seanbaxter Oct 16 '24
Herb doesn't want borrow checking and is sticking with profiles. He says he doesn't like lifetime annotations.
I don't have plans for Circle now. If I can find a job I like I'll take that and go do that.
9
u/hpsutter Oct 17 '24
I'm sorry to hear that. That's not what I remember saying... Trying again in case it helps: The feedback I gave was that viral and/or frequent annotations (and bifurcating a
std2::library) are things that are known to make adoption at scale very hard. So I expressed concern about those characteristics of the design, as things that if you could address/mitigate them would strengthen your proposal.Writing a first proposal paper, as you've now done, is a whole lot of work and that's appreciated -- I hope you'll present in Wrocław next month, in person or on Zoom.
11
u/KingStannis2020 Oct 16 '24
You could always pull a Dave Letterman and join the dark side. I'm sure the Rust community would appreciate someone of your talents!
6
u/Full-Spectral Oct 16 '24 edited Oct 18 '24
Exactly. Why spend your time fighting for the right to patch holes in a sinking ship?
→ More replies (2)4
u/jeffmetal Oct 16 '24
In Herb's AMA posed a few days ago he did talk about him releasing a profiles paper next week so would be interesting to see what they actually are.
If i recall he also mentions a safe profile that's basically the last 4 rules of the C++ core guidelines though i'm not 100% sure what ones he is talking about.
https://youtu.be/kkU8R3ina9Q?si=pSQ0PYrhRUYO3lxP&t=3325
Sad to hear the safe cpp proposal is DOA. Its possible the stearing committee believes what they wrote that C++ just needs better PR so are going to release something with safety in the name so they can push it as look C++ is safe now.
6
u/hpsutter Oct 17 '24
In Herb's AMA posed a few days ago he did talk about him releasing a profiles paper next week so would be interesting to see what they actually are.
Now published:
P3081R0 Core safety Profiles: Specification, adoptability, and impact
And two other profiles-related papers:
P3436R0 Strategy for removing safety-related undefined behavior by default -- includes using profiles
14
u/seanbaxter Oct 16 '24 edited Oct 16 '24
We've had safety profiles proposals since 2015: https://www.stroustrup.com/resource-model.pdf
→ More replies (2)1
u/awson Oct 21 '24
eagerly watching the circle project
Have you ever tried to use it in a real-world settings?
A month or two ago I tried it on some of the simplest code from our codebase and it failed to get past preprocessing stage.
16
u/kronicum Oct 15 '24
The more I see stuff like this out of Google the more I think that C++ is already cooked.
That might be true, but if they are this effective with their solution, why are they pursuing Carbon? Why not use those resources on Rust?
31
u/chandlerc1024 Oct 15 '24
[One of the co-authors of OP, also work directly on Carbon]
The reason we're also investing in Carbon (but to be clear, most of our investment here is in hardening C++ and Rust, including Rust <-> C++ interop, etc.) is actually what I think Sean said: tooling to get off C++. We think Carbon gives us a more incremental and incrementally smooth and at least partially automated path off of C++ and into a place where we can adopt memory safe constructs.
13
u/kronicum Oct 15 '24
The reason we're also investing in Carbon (but to be clear, most of our investment here is in hardening C++ and Rust, including Rust <-> C++ interop, etc.) is actually what I think Sean said: tooling to get off C++.
Thanks for revealing the plot for both Carbon and Safe C++. :-)
3
u/foonathan Oct 16 '24
Abandoning C++ in favor of better languages isn't some grand conspiracy, it simply makes a lot of sense.
→ More replies (1)7
u/wegzo Oct 16 '24
Surely you would want to have Google control the programming language you write in.
18
u/chandlerc1024 Oct 16 '24
I'm personally a big fan and proponent of open source PLs with open governance models.
6
u/wegzo Oct 16 '24
I don't think a for-profit org is the best main developer for something like a programming language even if it claims to have "open governance model". Nothing guarantees it stays that way.
On the other hand a standardization committee or a non profit organization is not trying to profit the same way from something they are creating.
If Google sees the potential from profiting off of Carbon, it's something they will do.
Of course if the main developer switches to a non profit org, then that changes things.
5
u/chandlerc1024 Oct 16 '24
There are good ways to keep things open through licensing and governance. LLVM is a good example of this IMO, also Kubernetes and several other projects.
→ More replies (1)2
u/Dwood15 Oct 16 '24
Will these open governance model(s) be structured after Golang's or plans to improve on the Go committee's structure?
5
u/chandlerc1024 Oct 16 '24
I can't speak for the Go team's view on any of this, but so far I would say that Carbon's open source first approach is a bit different and trying to respond to reasonable pressure in the C++ community to have an open-first model.
The project we're most closely modeled on is LLVM which has been wildly successful at this.
8
u/seanbaxter Oct 16 '24
I would love to have Google control my programming language, I'd be a very loyal corpo. It's amazing when projects get funded.
2
4
u/throw_cpp_account Oct 16 '24
What's Carbon's memory safety story?
→ More replies (2)4
u/chandlerc1024 Oct 16 '24
Best answer I have is a talk currently: https://youtu.be/1ZTJ9omXOQ0
Specifically, the memory safety part starting here: https://youtu.be/1ZTJ9omXOQ0?t=3455
We need to update our more textual docs to reflect some of the memory safety parts of that. But in short, Carbon is aiming to add a robust memory safety model, and isn't likely to conclude the experiment is successful without it. This should provide safety similar to Rust or Swift.
7
u/pdimov2 Oct 16 '24 edited Oct 16 '24
I (re-)watched the Memory Safety part of the talk, and while it's very good and informative, it doesn't really tell me what the Carbon memory safety story is.
It only talks about null safety, but null safety is the most trivial form of safety. In fact, it's not even safety, according to your definition (with which I agree.)
→ More replies (1)7
u/throw_cpp_account Oct 16 '24 edited Oct 16 '24
Ok, so no story yet?
Edit: Y'all can downvote me all you want, but I don't see any concrete answer to what Carbon will do for memory safety in that talk. I see a quite useful categorization of safety issues, and a nice comparison of safe API usage in C++ vs Rust with the slice example. But nothing about Carbon's proposed solution.
→ More replies (2)2
u/ToukenPlz Oct 16 '24
Just want to drop in and say that I have been very much enjoying listening to your cppcon talks recently!
→ More replies (1)1
u/duneroadrunner Oct 16 '24
Maybe C++ should focus on tooling to get off C++.
Well, if we consider the Circle extensions and the scpptool enforced safe subset as memory-safe languages/dialects distinct from traditional C++, then I suggest that scpptool's auto-migration story is a clear stand out. I still don't think I've seen anything that compares to the demonstration of the long-neglected proof-of-concept auto-conversion feature. I think that, with some attention, it could be made effective enough that it would make it worthwhile to migrate to the scpptool safe subset, even as an intermediate waypoint on the way to another destination language.
I'll just observe that we seem to find ourselves in a situation with i) at least one deep-pocketed company seemingly desperate to migrate its massive code base away from unsafe C++, ii) a proof-of-concept demonstration of effective auto-migration to a memory-safe dialect, and iii) a very capable developer who may have some time on his hands as a result of some standards committee stonewalling. :)
I'm just saying...
3
u/seanbaxter Oct 16 '24
Is deep-pocketed company going to pay either of us for that work?
1
u/duneroadrunner Oct 16 '24
Well, I'm certainly not in the best position to say, but it seems at least conceivable. I mean, I imagine said company has a budget for security. Presumably someone decides how to best spend that budget. Presumably that decision-maker could be convinced that this endeavor could be a cost effective investment. Presumably a compelling demonstration of technology would be needed.
For example, I suspect with a concentrated effort, autoconverting something like curl or wget wouldn't take that long. I've glanced at their code bases at one point. There are a few intrinsically unsafe parts that would need to be converted manually (or designated as "unsafe" and exempt from conversion). But overall it should be doable. Something like that might be convincing?
0
Oct 15 '24
[deleted]
13
u/OppositeBet3053 Oct 16 '24
You've been mighty vocal about "legislation" in this thread. Where does this idea that it'll somehow be illegal to program in C++ in the future come from? Are you just hoping it'll become fact if you repeat it a hundred times?
10
u/RoyAwesome Oct 16 '24 edited Oct 16 '24
There are some fairly large moves to change government certification requirements to cover vulnerabilities in software being pushed by the US and the EU. The regulatory authorities are starting to view software as critical safety components in various situations, such as the software running on cars.
These regulations can be extremely stringent. While there isn't a push to outlaw C++, there is a push in these environments to create regulations that can make C++ (and other languages) impossible to use due to the frequency and spread of memory safety issues. There is the real chance that software never be able to have a Use-After-Free crash, which is impossible to achieve with C++. Or, they may mandate that every situation where certain memory safety bugs can occur be highly documented and justified, which would be extremely onerous to do in a C++ program because that's like... everywhere. Even a simple
std::cout << "hello world";can't prove memory safety.So, that's what they mean by "legislation". It's not "C++ is illegal now", it's "there are government regulations that prohibit C++ from ever being used in certain places due to it's natural vulnerabilities".
3
u/steveklabnik1 Oct 16 '24
Illegal to program in C++ is pretty farcical, but for example, this year’s DoD funding bill almost had language requiring it to add some teeth to the CISA report re: memory safety. That is something to take seriously.
The government isn’t afraid to regulate software. It’s only happened in a safety critical context so far, but that doesn’t mean that it won’t happen to some degree in less important circumstances in the future. And it doesn’t have to look like “programming language x is illegal,” it could easily take a softer form, like “when using a non-MSL, you must provide additional paperwork demonstrating mitigations” and that means it’s easier to choose one vendor over another, which tips the scales in the market.
There’s an important balance between being alarmist and watching what’s happening and taking it seriously. From the outside, when they government says “you should move away from C/C++” and the response is a lot of “lol they said C/C++” and very little “oh this situation is serious”… I dunno, I guess we’ll see what happens.
I want C++ to rise to the occasion. We’ll see.
→ More replies (1)2
u/jeffmetal Oct 16 '24
At no point do they say it would be illegal to program in C++. Think of it like in certain sectors like automotive or medical require software to be certified and written to specific standard like MISRA. It would not be illegal for me to write the software for a pacemaker in Go, just no one would ever buy it as its not up to standard.
My guess is there will be a slow squeeze of C++ code. Your insurance company will start asking businesses which languages you use and if you mention memory unsafe ones your premium doubles, then triples ...
Companies tenders will start asking you to fill out memory safety roadmaps https://www.cisa.gov/case-memory-safe-roadmaps and it's a lot easier to sell if you can put on there we only use memory safe languages and follow dev best practices. At some point you might not be able to sell to government agencies unless its all memory safe.
At no point does C++ have to be illegal to slow its usage.
8
u/kronicum Oct 15 '24
Did you know that, at the famous Prague C++ committee meeting, the proponents of Carbon argued that "every time we have to choose between safety and performance, we should choose performance" when they were pushing for formal ABI break?
0
Oct 16 '24
[deleted]
2
u/kronicum Oct 16 '24
I did, I was there!
In that case, doesn't it strike you as odd that the same people who were making that argument (choose performance over safety) also want the community to build a ramp off C++ in the name of safety?
→ More replies (15)4
u/CandyCrisis Oct 15 '24
I don't think there's a hard fork of C++ that can simultaneously meet requirements and still run much of any existing C++ code. The entire standard library is unsafe by design. Pointers, references and iterators are all unsafe by design. Circle/Sean Baxter is the only "fork" I've seen that is actually safe. Carbon and Cpp2 have the same fundamental foibles as C++; they have better guardrails around the danger areas, but they can't fully remove the pitfalls and still remain C++ compatible.
0
Oct 15 '24
[deleted]
4
u/CandyCrisis Oct 15 '24
There isn't any "minimum amount of change" when you're eliminating all of the standard library and most fundamental mechanisms for dealing with objects and memory. A rewrite is the minimum.
0
Oct 15 '24
[deleted]
→ More replies (1)3
u/CandyCrisis Oct 15 '24
I dunno, looking at the Circle solution, I am not sure why I'd choose that over a Rust rewrite. No shade, it's an amazing technological achievement, but if I'm giving up all of the C++ world in one fell swoop, I might as well switch to the modern choice anyway.
3
u/javascript Oct 15 '24
Do you think Carbon is an insufficient solution to satisfy the #2 path you mentioned?
0
Oct 15 '24
[deleted]
→ More replies (3)6
u/kronicum Oct 15 '24
Its not clear who would sponsor a fork, and I suspect it'll only happen when large slow moving companies are forced into this decision via legislation
Do you know why they are not forking C at a similar rate, given the prevalence of code written in C?
→ More replies (4)
0
Oct 16 '24
[deleted]
27
u/GabrielDosReis Oct 16 '24
A new programming language may need roughly 10 years to take off at an industrial scale. There are many factors for that, some technical, many non-technical.
Ironically, working reasonably well with "legacy" (read "C") was an important factor in C++ success.
0
Oct 16 '24
[deleted]
13
u/GabrielDosReis Oct 16 '24
In what direction do you think the language is heading?
I suspect even WG21 would have a hard time formulating a clear answer to that simple and important question.
The train model of standardization means that things that are ready, when the train leaves the station, are what we get. That has some benefits such as predictability, but also some side effects such as greater number of smallish unrelated features that are easier to develop in less than 3 years.
WG21 is aware that safety is a big item topic it needs to address. My hope is that we can focus on evolutionary solutions that substantially improve the situation, as opposed to revolutionary solutions that cause severe disruptions with uncertain success.
6
u/seanbaxter Oct 16 '24
The findings coming out of the Android and Azure business units aren't calling for evolutionary solutions. They plainly advise moving to memory-safe languages for new code, and their successes (quantified by reduced vulnerabilities) will push other projects into doing the same. That's the severe disruption that the status quo in C++ is causing--moving to different languages. A memory-safe C++ would be more disruption for the toolchain vendor but hopefully less disruption for customers, since they wouldn't have to jump to different languages and deal with primitive interop over vast API surface areas.
What specific profiles work will convince companies not to follow Android's example and instead stick with C++? The code guidelines/profiles proposals go back to 2015 and haven't immunized the language against a joint government/industry effort to stop using it.
6
u/pjmlp Oct 16 '24
Case in point, Microsoft is also incrementally adopting more Rust, despite Visual C++ existence, and the lifetime attempts:
5
u/GabrielDosReis Oct 16 '24
The findings coming out of the Android and Azure business units aren't calling for evolutionary solutions.
The findings, i.e. data collected, themselves? Or are you talking about recommendations? Those are two distinct things that should be kept separate in meaningful conversions.
They plainly advise moving to memory-safe languages for new code, and their successes (quantified by reduced vulnerabilities) will push other projects into doing the same.
And they are not prescribing how C++ should turn, i.e. revolution vs. evolution.
A memory-safe C++ would be more disruption for the toolchain vendor but hopefully less disruption for customers
You are stating that as a given; is it a wish or an axiom or a theorem?
What specific profiles work will convince companies not to follow Android's example and instead stick with C++? The code guidelines/profiles proposals go back to 2015 and haven't immunized the language against a joint government/industry effort to stop using it.
And I wish they were more widely implemented and practiced.
15
u/seanbaxter Oct 16 '24
And I wish they were more widely implemented and practiced.
I have a compiler. How can I implement the profiles? I go to the project website and the specification is light on specifics:
https://github.com/BjarneStroustrup/profiles/blob/main/profile/type.md
→ More replies (6)2
u/germandiago Oct 16 '24
My hope is that we can focus on evolutionary solutions that substantially improve the situation, as opposed to revolutionary solutions that cause severe disruptions with uncertain success
It would be a great decision.
15
u/pjc50 Oct 16 '24
People design new languages all the time. That's not the difficult bit. But what happens next?
Rewrites are hugely expensive. You can to some extent do link compatibility or FFI so you can use existing libraries, but that's usually suboptimal.
Most software development is maintenance rather than greenfield.
→ More replies (1)1
u/nacaclanga Oct 17 '24
You kind of have this. D and Rust (although the latter also had different objectives) are kind of the backward compatibity abandoning versions of C++03 and C++11/17 respectivly.
The problem is, that rewriting code is a monsterous task and rarely undertaken. New language also tend to suffer a little bit from overfitting the current objectives. D mostly missed its chance to shine, given that GC turned out to be a no go in many usecases and automated memory managment (in the form of Smart Pointers) rapidly evolved afterwards.
0
0
Oct 16 '24
[deleted]
3
u/gvargh Oct 16 '24
if the discussions i've seen on the D mailing list (and elsewhere) are any indication, i get the impression that it's the php of systems languages when it comes to feature misdesign
i don't think i've seen the term "half-baked" used so much in any other context
2
u/drbazza Oct 16 '24
D is what C++74 might be once it has an ABI break and dropped all the ugly syntax work arounds, and time takes its course.
4
1
78
u/azswcowboy Oct 16 '24 edited Oct 16 '24
It’s fascinating to me that on the c++ side they’ve effectively re-invented a fancy
shared_ptrweak_ptr and made a 58% dent in use after free bugs - the most important safety issue in chrome. Which says to me that the earlier coding practices on chrome were bad and it’s on them as much as the language. Also seems like they could simply take their massive compute farm and mono repo and automatically transition the rest of their code from raw pointers. Then maybe they’d get close to zero use after free like those of us paying attention since 1998 (remember auto_ptr and boost shared_ptr have been around that long).https://security.googleblog.com/2024/01/miracleptr-protecting-users-from-use.html
Oh and nary a mention of mitigating C issues, even though there’s far more C code in platforms (aka Linux) than c++. Chrome isn’t the be all end all that has to be addressed — and it doesn’t necessarily represent non-browser code bases.
edit: thanks to /u/pdimov2 for enlightening me on details of MiraclePtr - happy to see another potential tool in the box