r/cpp • • 4d ago

Google talk at REBASE'26: Agentic Coding is not going to save C++

So the REBASE'26 conference happened recently, and besides the whole thing of what Carbon has achieved or never will, there are talks like this one from Google folks, regarding what they are doing with their C++.

The talk is all about the recent ongoing migration discussed on Google security blog, and other related efforts.

https://www.youtube.com/watch?v=Ob0CMX8s55s

74 Upvotes

200 comments sorted by

43

u/tartaruga232 MSVC user, r/cpp_modules 4d ago

One of their slides at 2:36 mentions "C/C++ security bugs". I'm not yet sure if I should continue listening.

11

u/Lexinonymous 4d ago

Why's that? For context:

Agentic coding both exploits and introduces C/C++ security bugs and particularly memory safety bugs faster than anyone can fix them.

28

u/Syracuss graphics engineer/games industry 4d ago

Because C and C++ are different languages.

They do share a lot of overlap, but they aren't the same. If you still use the term C/C++ right now you are either working on a pre-C++11 codebase, or are not in touch with the language as it is nowadays.

21

u/Lexinonymous 4d ago

Because C and C++ are different languages.

Does this remind anyone else of the annoying GNU/Linux naming controversy?

Yes, they are technically two different languages. Yes, C++ is technically a near-superset of C. No, someone using "C/C++" in a sentence doesn't automatically make what they have to say invalid.

25

u/Chaosvex 4d ago

I've always recommend that people avoid writing "C/C++" on their resumé because it's likely to be interpreted as a signal that they don't actually know C++ very well. It's usually a pretty good signal, too.

18

u/pjmlp 3d ago

Some WG21 members have papers with C/C++ on them.

17

u/Lexinonymous 3d ago

Well, it does appear that arguing over "C/C++" has successfully derailed a thread of conversation to the point where nobody is engaging with the points in the presentation.

I suspect this was likely the intended outcome. Anything to avoid talking about the elephant in the room.

7

u/pjmlp 3d ago

Of course it is the goal, which is why security community never takes the C++ community seriously.

The arguments around C/C++, or the usual "what do you mean by safety?" question, always feel like kids arguing for not doing their homework.

-6

u/hanotak 3d ago

What? I have experience with both C microcontroller programming and C++ application programming. I have experience with C/C++.

13

u/Wurstinator 3d ago

No, you have experience with C and you have experience with C++.

I don't have experience with Java/C++.

It's a free world, you can write "C/C++" on your CV if you want to, but /u/Chaosvex is right, it's a signal that will likely get you turned away.

8

u/pjmlp 3d ago

I surely do have experience with Java/C++, have converted enough C++ projects into a mix of Java calling into C++ via JNI.

4

u/hanotak 3d ago

Looks like it also works to filter out nitpicky managers who are more concerned with micromanaging phrasing to sound superior than they are with doing their actual job.

6

u/vetinari 3d ago

It not nitpicking.

If you are conflating them and do not see difference, it signals that you would not hesitate using C constructs in C++ codebase. Unless the task at the hand is working on an ancient codebase, it is a reason not to want someone like that in the team.

10

u/hanotak 3d ago

It very much is nitpicking to assume that someone using what is effectively an abbreviation for ‘c and c++’ means they think the languages are the same thing. If I say “I have experience in data analysis, mostly with Python/R”, does that mean I think Python and R are the same thing? No, it means I’m placing them together as skills grouped together by similar category. The closer the languages are for the context one is writing for, the more appropriate the grouping is.

You’re all taking a linguistic categorization choice and extrapolating it in your head into something it absolutely does not mean. I can only imagine it’s to stroke your own egos over how much smarter you are. If this is how engineering managers think, I can see why teams end up in the states they often do.

-2

u/pjmlp 3d ago

Like printf(), scanf(), C arrays and C null terminated strings, bare bones pointer arithmetic, out pointers instead of references?

-1

u/Wurstinator 3d ago

You can cope as much as you want and make up arbitrary reasons if you want. As I said, it's a free world, it's your right to design your CV as bad as you feel like, and then get mad and insult people on the internet to feel better about getting rejected.

Other people, in the meantime, just take the advice they are given to improve their own chances at a good life.

2

u/gimpwiz 3d ago

I have experience with C/C++, in other words, I've worked on projects that were written in the style of "C with classes." Frankly a lot less annoying than writing C in an object-oriented way, I really don't enjoy passing around handles to structs to operate on them.

I also have experience with C and experience with C++ ;)

2

u/Wonderful-Habit-139 3d ago

I also have experience with C/C++/Rust.

10

u/johannes1971 3d ago

This is not a mere naming issue, and yes, throwing two languages that have wildly different vulnerability rates into a single bucket does in fact make their position invalid.

2

u/Syracuss graphics engineer/games industry 4d ago

I didn't say what was being said is invalid. I'm giving you a response to your "why's that" question. I did add an opinion, but hey, it's reddit.

5

u/pjmlp 4d ago

All companies in WG21 have code samples with C style code in their C++ samples, and routinely use C/C++ either on their documentation, or job descriptions.

13

u/Syracuss graphics engineer/games industry 4d ago edited 4d ago

WG21 never uses C/C++ to describe itself or its standard, individual authors who submit papers can, and will, but WG21 has never used it as far as I can remember. You are free to pull up sources, I did do a cursory search which yielded nothing.

I do think it's quite irrelevant what job descriptions say, nor do I think it's particularly useful to fight a community on how you would prefer to name them. It's kinda disrespectful.

I find the heat in this thread to be too large for such a silly topic as well, so I'll be bowing out.

0

u/pjmlp 3d ago

I did not mention WG21, I mentioned the companies that sell C and C++ compilers, or have operating systems with C and C++ compilers on their SDKs, and have employees that happen to seat at WG21.

5

u/Minimonium 3d ago

All companies in WG21

I did not mention WG21

what

4

u/pjmlp 3d ago

All companies in WG21 have code samples with C style code in their C++ samples, meaning the products with code C++ code samples that those companies sell, or provide freely to us, developers on the trenches.

Give one name on WG21 sponsor companies that has C++ compilers or OS SDKs, and I will provide you a recent code sample with something that comes from C, provided it is public source code.

4

u/Minimonium 3d ago

That's a really wild claim

0

u/pjmlp 3d ago edited 3d ago

Indeed, give a name.

Microsoft, NVidia, Apple, whatever

Public source code for C++ SDK and library samples, and I will provide whatever is there, instead of what should be, in terms of modern C++ safer alternatives.

C arrays, C strings, stdio, stdlib, pointer arithmetic,....

Ah, and if inspired, I can also check the HR job offers with C/C++ in them, or some docs even.

Since learning C++ that I hate the code C in C++ style, the worst offenders being "C++" libraries written in the common subset of both C and C++.

→ More replies

1

u/awson 2d ago

Surely, something shall come from C, since all OS SDKs provide C APIs.

And everything in existence (and Rust too, absolutely) consumes these APIs.

Moreover, many (even modern) C++ (and Rust too, absolutely) libraries may have a layer, exposing C APIs, because they are what everything can talk to.

But I still interested to see something that falls outside of these, in e.g. modern (written after, say, 2023) Microsoft C++ code.

-1

u/HommeMusical 3d ago

If you still use the term C/C++ right now you are either working on a pre-C++11 codebase, or are not in touch with the language as it is nowadays.

Or you have a bigger perspective on the world.

I admit to spending decades in the C++ corner, but buffer overruns and most of the other ways to get people to execute arbitrary code in memory are common to C and to C++.

28

u/chaos_pill 3d ago

C/C++ security bugs

In some talk, herb sutter showcases two code samples: one is modern cpp and the other C. He points out that both are c++, and you can't forever hide behind "oh, that's not real/proper c++". You are not going to magically eliminate bugs by renaming files from foo.c to foo.cpp. Unless you ban the "C" parts by default, they still count as C++ as they compile with a C++ compiler.

-2

u/tartaruga232 MSVC user, r/cpp_modules 3d ago

The same holds true for Rust. Just use the unsafe keyword. Herb also showed that most of the vulnerabilities found in the wild are found in C code, not in C++. Sure, if you really want, you can shoot yourself in the foot with C++ too. AI will probably soon be able to reliably spot problematic uses of C++, way faster than you can rewrite any existing C++ code in a so-called "safe" language.

14

u/t_hunger 3d ago

Unsafe rust does not work like you think it does: The compiler enforces what it can enfore in identical ways in safe and unsafe blocks.

Herb also showed that most of the vulnerabilities found in the wild are found in C code, not in C++.

So the bugs do not show up when compiling with a C++ compiler? Its buggy C++ code otherwise.

AI will probably soon be able to reliably spot problematic uses of C++, way faster than you can rewrite any existing C++ code in a so-called "safe" language.

True, but AI can just as reliably port code to safe languages, and gets help from the compiler doing that. E.g. with stricter enforcement on what is a correct program, with better error messages, and great linting that can just stop the AI from using arbitrary APIs as needed in a project. There is a reason why so much generated code is in rust.

Plus there is money being poured into making the C/C++ to rust conversion with AI help an out of the box experience, e.g. with the DARPA TraCtoR project.

4

u/tartaruga232 MSVC user, r/cpp_modules 3d ago

Sure. It's probably a good idea to use Rust instead of C. But C is not C++.

7

u/pjmlp 3d ago

Plenty of C is perfectly valid C++, documented on ISO C++ as being C++ proper, and will be compiled without errors by a C++ compiler.

6

u/arjuna93 3d ago

> just as reliably port code to safe languages

Sure, you can port to “safe” languages, but in most cases at a much higher cost – to do it reliably – than just fixing original code.

8

u/chaos_pill 3d ago

The same holds true for Rust. Just use the unsafe keyword.

unsafe Rust is a superset of safe rust and you can ban unsafe by just using a linter rule. Good luck banning unsafe "C" (or otherwise) parts in C++.

safety must be enforced reliably by compiler. It's the same reason we have proof languages like Lean that AI use to prove math. AI (being probabilistic in nature) can't even produce code that compiles on the first try, there's no way it can provide safety/proof guarantees.

2

u/CreativeAlbatross319 1d ago

"Good luck banning unsafe C parts in C++"

Ever used clang-tidy with all warning enabled? That's exactly what it does.

1

u/chaos_pill 1d ago

clang-tidy, by design, does not (even claim to) ban all unsafe C parts.That's what profiles are for, to reliably enforce a safe subset inside unsafe superset.

Even if cpp-without-c becomes a thing, it would be a new subset language, because C++ can't break backwards compat.

2

u/CreativeAlbatross319 23h ago

what unsafe C part is not banned?

1

u/chaos_pill 11h ago

think of common patterns that are too pervasive in legacy. eg: raw pointers (not every usage will be guarded by null check), [tagged] unions, int overflow

Any rule that would, generate too many false negatives or is too expensive to analyze, without language support (i.e. profiles).

1

u/CreativeAlbatross319 10h ago

Raw pointer deference is a hard decision. In many cases you don't want it checked to get the max performance.

Tagged union pretty much not allowed as clang-tidy forbids any usage of C enum and access of any union type.

Int overflow is the same story as raw pointer deference, as it potentially damages the performance or compiler optimization.

1

u/chaos_pill 9h ago

yeah, nobody's criticizing them for making sane decisions. Just pointing out that unsafe C heritage is hard to remove in theory, but almost impossible in practice (the vast majority of code is still legacy c/c++, and they are not going to adopt profiles or even clang-tidy anytime soon).

→ More replies

-2

u/OutlandishnessNo8034 3d ago

What do you mean same holds for Rust?

53

u/KFUP 3d ago

It's the usual way these posts/talks go, pretend it's C++ issue, then when it comes to the actual vulnerabilities, 95% of them are C issues than can be easily fixed with RAII and ranges, then back to pretending it's a C++ issue.

Especially Google with their "70% bugs are memory bugs", then turned out they have been using C array and didn't port it to std::vector until 2023, std::vector has been around since 1998! Am I supposed to take what they say seriously?

17

u/13steinj 3d ago

I have mixed feelings here.

I agree with you whole heartedly. But the other side will say "all those C vulnerabilities are valid C++," which is true. You can't eliminate the ancient code. Sometimes you have to rewrite large swaths of it, at which point not more expensive to rewrite in a language that "can't" reintroduce the problem.

"It's ancient C++" is not a valid argument to this other side. It's the same theme of obstinence for Profiles vs. Contracts.

6

u/def-pri-pub 3d ago

“95% of them are C issues…”.

I 100% agree. There is one other core issue that isn’t so much the language but how people use it. Many times I’ve been in “C++ codebases” that were just plain C code bases being run through a C++ compiler.

12

u/abuqaboom just a dev :D 3d ago

That's Google with their 1 memory bug per 1000 lines. 

Fortunately, it ain't the 2000-10s anymore, devs are more skeptical of anything big tech spouts these days.

-2

u/ElderberryNo4220 3d ago

> Especially Google with their "70% bugs are memory bugs", then turned out they have been using C array and didn't port it to std::vector until 2023, std::vector has been around since 1998!

I assume you mean array container, and not vector. Unless the C array is heap allocated, then vector makes sense.

5

u/matthieum 2d ago

I find this nitpicking lame, to be honest.

The fact is that C and C++ do share many issues, especially around memory safety.

Is modern C++ code looking quite different than C code? Sure.

Is modern C++ code memory safe? Not by any stretch of the imagination:

  • It doesn't matter that your memory is owned by a smart pointer, if that lambda or coroutine captured a reference to it and runs after the smart pointer was dropped: you still have a use-after-free right there and then.
  • It doesn't matter that .at() is bounds-checked, when operator[] on spans, arrays, vectors, or deques isn't and that's what most code uses: you still have out-of-bounds accesses right there and then.

The one memory safety issue than modern C++ mostly eliminates -- thanks to smart pointers/owned containers -- is double-frees.

That's not nearly enough to differentiate itself from C, in this regard.

(I mean, surely you use sanitizers/valgrind as part of CI to try and weed out all these memory vulnerabilities, don't you?)

3

u/FrogNoPants 2d ago

We've had optional hardening on vector [] for like 15 years now..

1

u/matthieum 1d ago

I've one seen hardening enabled in production code, unfortunately.

Part of it may just be inertia/poor communication, certainly, but opt-in only helps if users actually opt in.

0

u/tartaruga232 MSVC user, r/cpp_modules 2d ago

I find this nitpicking lame, to be honest.

It's indeed lame to accuse C++ if 95% of all real world vulnerabilities are actually found in C code. I don't write C code. I write C++.

2

u/drbazza 3d ago

Imagine talking about NullPointerExceptions and lumping Kotlin/Java together as a 'single language'.

Both can have them except Kotlin has pretty much zero.

-5

u/pjmlp 4d ago

Ah, the usual attitude from C++ community that tells SecDevOps where they are coming from.

What does / mean between words?, courtesy of Grammarly.

6

u/tartaruga232 MSVC user, r/cpp_modules 4d ago

Combining C and C++ into the same category doesn't make sense.

27

u/pjmlp 4d ago

Until C++ stops accepting C89 subset as valid C++, it definitely makes sense.

Many people insist into using C header files, C arrays, C strings in C++ code, C pointer arithmetic, C casts, instead of the safer alternatives introduced by the C++ standard library.

10

u/johannes1971 3d ago

It's not the potential for abuse that matters. The only thing that counts is bugs in the wild.

If the potential for abuse mattered, than Rust is as unsafe as C++. After all, you can write 'unsafe' blocks, so the potential for abuse is always there. It doesn't matter that they are few in number. It doesn't matter that they are easy to find. It's the potential that matters.

Or, if that's not your argument, then the only way to progress understanding on this issue is to count actual bugs, rather than potential bugs. And so far, real-world experience suggests that C++ vulnerabilities occur at over a 10x lower rate than C vulnerabilities.

7

u/pjmlp 3d ago

That is arguing for semantics, if it is a bug in code compiled with a C++ compiler, it is a C++ bug, regardless where the language construct was initially designed.

And does a disservice for the community in the eyes of SecDevOps, that have to spend an all night updating an application written in C++, compiled with a C++ compiler, for a security exploit that apparently is "C".

5

u/johannes1971 3d ago

So how, then, do you explain the difference in vulnerability rates?

2

u/pjmlp 3d ago

What difference?

Looking at C++ source code, with C style code vulnerability does not make it C code, if it was compiled with a C++ compiler, it is C++ as per the International Standard ISO/IEC 14882:2024(E) – Programming Language C++.

Only clever misuse of semantics, that make C++ community look bad to SecDevOps community, doing pentesting and gatekeeping what lands into production.

5

u/t_hunger 3d ago edited 2d ago

Do you have evidence backing the claim that there are differences in vulnerability rates?

I am not saying there is none, but in my experience it is super hard to find any number for C++ without somebody yelling "That's not really C++ code, that is C!"... even when the code is in projects that no C compiler can compile.

It feels like any C++-code automatically turns into C whenever there is a memory issue :-)

1

u/johannes1971 1d ago

Someone posted a link here a while ago, but of course I cannot find it now. It was something like 92% of the issues were in C libraries, with only 8% in C++ code.

I do not quite understand why you and pjmlp need to confuse the issue so badly on what the actual language is that something is written in. There are numerous libraries out there that are pure C: they are written in C, intended to be C, and compiled with C compilers. Can we agree that we will call that "C"? I am not here to argue that if a single line of code in a C++ library could compile with a C compiler, that makes it a C problem. I'm arguing on the level of entire libraries, and on that level the distinction between what is C and what is C++ is extremely clear. Yet somehow, you felt you needed to add a little barb about C++ code "becoming" C - what is that even supposed to mean? How does C++ code become C? I've written a lot of C++ in my life; I can assure you it does not magically become filled with strcpys, mallocs, frees, naked pointers, and all that jazz; someone has to go and do a lot of rewriting to make that happen. Do you perhaps believe that it takes great mental effort to use std::string or std::vector, and that everyone naturally gravitates towards the 'easier' solution of the C idioms, even when writing C++? Or that using such 'modern' features as strings and vectors don't really occur in C++, unless the author is one of those people that visits conferences and writes WG21 papers?

-2

u/t_hunger 1d ago

Yet somehow, you felt you needed to add a little barb about C++ code "becoming" C - what is that even supposed to mean?

I was making fun of the people that go "oh, that is not really C++!" when google publishes a paper on bugs in chromium and android. It's compiled by a C++ compiler, yet somehow the issues reported should still be counted as C because google supposedly did something or another.

0

u/Inevitable_Vast6828 1d ago

Obviously by the semantic patterns and available libraries. There are also standards for straight up C code that produce code with vastly diminished vulnerability rates. This frequently involved using patterns that are amenable to static analysis, etc...

But it's not like the vulnerability rate is lower just cause it's C++. You can do RAII in C, etc...

2

u/johannes1971 1d ago

Obviously by the semantic patterns and available libraries. [...] But it's not like the vulnerability rate is lower just cause it's C++.

You make it sound as if you disagree with me, but this is _why_ C++ is safer: because it has those libraries, and because with those libraries (and language rules that C lacks) you can use those semantic patterns.

You can do RAII in C

That's great news for the C community! Or well, it would be, if it were true...

1

u/Inevitable_Vast6828 1d ago

Yes, Rust IS as unsafe as C++ for anyone with an ounce of competence. Granted... that's very few people.

6

u/wyrn 3d ago

"Doctor, it hurts when I stick a fork in my eye"

9

u/pjmlp 3d ago

Unfortunely I am yet to enconter any C++ project where there are no inherited C language constructs or header files being used.

7

u/wyrn 3d ago

You'd be hard pressed to find a project in any language that doesn't depend on C on some form or another. It doesn't mean the pain of the C/C++ers isn't self inflicted.

-3

u/pjmlp 3d ago

If we could only get rid of UNIX. /s

1

u/t_hunger 3d ago

Redox-os.org is trying and even has libc written in rust :-)

0

u/Wonderful-Habit-139 3d ago

I thought it doesn't? C++ requires casting malloc.

2

u/pjmlp 3d ago

The C subset available in C++ is a little bit more than malloc().

5

u/Wonderful-Habit-139 3d ago

So if someone says {1, 2, 3} is not a subset of {1, 2, A, B, C} because 3 is not there the answer is that there's more than the number 3?

4

u/pjmlp 3d ago

It starts by not using C strings and C arrays, other than as building blocks for standard library types, safer and bounds checked enabled.

Then no C style casts, no C headers for equivalent functionality already available in the C++ standard library, no C style pointer arithmetic other than low level implementation code, no printf and scanf, no memcpy, no memset, no strcpy, no strcmp, no strtok, no ...

1

u/Wonderful-Habit-139 3d ago

Excuse my haste. You want for C++ to reject more and more of the C89 subset basically.

That sounds nice, and even nicer would be to reject a subset of C++ as well :p

4

u/pjmlp 3d ago

Yes, and since we are supposed to have profiles, one of them should be to disable everything inherited from C, unless it is under a [[profile:unsafe_c(allow)]] kind of block.

Then yes, folks can argue that C style code in C++ codebases does not exist.

3

u/Jovibor_ 3d ago

Answering in this logic:  

Until Rust stops accepting 'unsafe' as valid Rust, it definitely can not be a memory safe language.

3

u/OutlandishnessNo8034 3d ago

That's nonsense and shows complete misunderstanding of rust.

2

u/fsxraptor 2d ago

Yes, I think that's what the statement is meant to demonstrate.

10

u/sokka2d 4d ago

It does when it comes to memory safety.

8

u/wyrn 3d ago

And yet, C++ programs are vastly easier to write correctly and safely than C programs.

It doesn't make sense combining C and C++ in the same category especially when it comes to memory safety.

4

u/t_hunger 3d ago

A language where a programmer can opt into using safe constructs that prevent a class of bugs possible in the other language => the two languages are in a different category from each other and should not be compared.

A language where a programmer can opt out of using safe constructs that prevent a class of bugs possible in the other language => these two langauges are basically the same.

I do not find this logic compelling.

It doesn't make sense combining C and C++ in the same category especially when it comes to memory safety.

Both are not memory safe.

Please learn what memory-safe means before coming up with "memory-safer".

1

u/sokka2d 3d ago

Neither of them is memory safe. That makes them the same category in context.

3

u/wyrn 3d ago

Rust has unsafe, so by the same standards it's not memory safe either. What matters is actual risk under normal use, not theoretical worst-case risk.

3

u/sokka2d 3d ago

No, that is most definitely not the same standard. Outside of unsafe blocks, the compiler proves memory safety. That is quite different from “C is memory safe if you just git gud” and “C++ has more tools to git gud.”

There is a categorical difference between C and C++ vs Rust.

3

u/wyrn 3d ago

Outside of unsafe blocks, the compiler proves memory safety.

It doesn't work that way. Even a single (nontrivial) unsafe block drops formal guarantees for the entire program. Furthermore, safe Rust is unsound anyway.

If theoretical worst case is what you're concerned about, it's the exact same.

0

u/sokka2d 3d ago

And Python or Java aren’t memory safe either because you can fall back to C plugins. Ergo, the term memory safety has no meaning. Which is a very unproductive take.

If you insist on being wrong, go ahead. But don’t blame the author for using a slash between C and C++ when it is clearly justified to do so.

→ More replies

-2

u/HommeMusical 3d ago

As someone who started writing C years before C++ existed, well, it makes a great deal of sense, even though in 2026 I basically can't write C anymore because I haven't touched it in years.

In particular, when it comes to security issues, there is little light between the two languages - both of them let you essentially read or write to any memory address you can to specify.

6

u/tartaruga232 MSVC user, r/cpp_modules 3d ago

I started professionally with C myself in the nineties. Sure, I can call new and delete if I want in C++ code. But in modern C++ code such code is rare and encapsulated in well known abstractions (classes with destructors). We use std::string and std::vector day in day out in C++ nowadays. Not memcopy. I aggressively refactor quite a lot C++. The expressiveness with modern C++ is enormous. I can express my intent using C++. The average C code security bugs in practice are not relevant to me as a C++ programmer, as I'm not feeding C code into our C++ compiler.

-2

u/HommeMusical 3d ago edited 3d ago

We use std::string and std::vector day in day out in C++ nowadays.

I first started programming in C++ around 1988, so yes, I do indeed know that.

I'm not feeding C code into our C++ compiler.

This would imply that you never use C strings, and thus the " mark never appears in your code, except in comments.

This would also imply that none of your code, and none of the libraries you use, ever use the C standard library.

I am skeptical.

I have used dozens of languages professionally in fifty years of programming. I'm trying to think of one mdoern language other than C or C++ (or CUDA, which is another C derivative) where a[i] = x; can overwrite random bytes in memory and I draw a blank.

26

u/IceMichaelStorm 4d ago

Ragebait title. If the conf really says it like this, THEY do the ragebait.

Or it’s just a trash conference or at least trash talk

17

u/pjmlp 4d ago

Google is the one responsible for how their talk is named, the full title is Programming Languages in the Agentic Coding Era: Agentic Coding is not going to save C++, which you can easily verify yourself by following the link.

3

u/Inevitable_Vast6828 1d ago

C++ doesn't need any saving in the first place.

12

u/IceMichaelStorm 4d ago

Good. Then Google is the trash boy.

Understandable. They seem to become worse and worse

8

u/El_RoviSoft 3d ago

they want to eliminate C++ from their codebase for a long time already

65

u/Kronikarz 4d ago

Talks like this make me realize I got out of the industry at the exact right time

15

u/WillingPirate3009 4d ago

Retired or just given up?

29

u/Kronikarz 4d ago

Given up.

18

u/WillingPirate3009 4d ago

It's a shame. Good luck!

33

u/FckXFckMusk 4d ago

Just follow the money on all these doomsayers..

New languages are 10 a penny..

6

u/amoskovsky 2d ago

Ahaha, RIP Carbon!

56

u/Anxious-Resist8344 4d ago

It seems there are not many ways these days to stay relevant in "big company" but to create power points talking about memory safety, C++ and Rust :)

What's wrong with "let's fix all the vulnerabilities coming in until there's nothing else to fix"?

In the Agentic Coding Era languages don't matter much, but since humans will always matter, language familiarity is key!

33

u/YoureNotEvenWrong 3d ago edited 3d ago

  In the Agentic Coding Era languages don't matter much,

This is the big mistake people still make. Languages still absolutely matter, each language still has pros and cons. Familiarity is a pro.

Also, the code still matters, how can you recognize bad code patterns the LLM is churning out systematically and have your system fix them if you can't recognize them

LLMs are simultaneously incredibly intelligent and very dumb

2

u/aoi_saboten 2d ago

Yep, language and tooling matter a lot with agents. That is why Rust rewrites/adoptions are happening in big companies

-2

u/YoureNotEvenWrong 2d ago

I think rust is chosen a lot because it's fashionable, same reason why typescript surged with AI frameworks. Typescript AI Frameworks sucked balls though 

Big issue with rust is that few actually know it and can't judge what's being output

27

u/panderingPenguin 3d ago

What's wrong with "let's fix all the vulnerabilities coming in until there's nothing else to fix"?

Hasn't that been the strategy since... the dawn of programming? 

There's always more to fix, and plenty of new code adding new things to fix (especially these days).

4

u/Anxious-Resist8344 3d ago

I mean, AI is good at finding vulnerabilities, not so good at the rest (something I'm not going to argue).

I think a good strategy for now would be to focus on fixing things, at the end of the day AI is not the only one writing slop.

14

u/chaos_pill 3d ago

"let's fix all the vulnerabilities coming in until there's nothing else to fix"

We don't have infinite resource. There's also cost to consider, as competing products will undercut you.

Languages do matter, as you can see by so much AI slop using Rust. eg: doing OOP in C vs C++ is like writing UB-free code in Rust vs c/c++. One choice is just far more convenient than the other! Even for AI, it matters because it makes mistakes too. If AI wrote perfect code, we wouldn't call it slop.

10

u/James20k P2005R0 3d ago

We don't have infinite resource. There's also cost to consider, as competing products will undercut you.

It'd be nice if the trillion dollar companies put some resources towards fixing it though. A lot of the current wave of security exploits is still because projects like Curl/OpenSSL/etc are drastically underfunded compared to their utility

6

u/ElderberryNo4220 3d ago

Rewriting some of the critical projects in memory-safe languages probably counts towards *fixing*.

6

u/matthieum 2d ago

Maybe, maybe not.

In one his latest post, Daniel Haxe (cURL) touched on that. LLMs are pretty good at rewriting code, and Rust is a popular target (if it compiles, it works, or close to) so he's been seeing quite a few LLM rewrites of cURL.

But those are just point-in-time rewrites. Generally already weeks out of date compared to cURL's main branch by the time they're completed. And there's no team to maintain them. Utterly Pointless.

(Also, of course, those rewrites, being in Rust, do not accommodate the full range of platforms cURL is used on; there's a reason it sticks to an old version of C: maximizing platform compatibility)

0

u/t_hunger 2d ago edited 2d ago

I am sure Google has enough resources to follow up the initial rewrite oft the stuft they use in-house.

I also doubt platform compatibility (for any platform not supported by rust anyway) is a problem for google either. They do not ship for exotic hardware anyway, or can just add what they need to LLVM.

0

u/matthieum 1d ago

Google certainly would, yes...

... but what would their priority be with regard to platform support? Would they care about embedded? Or only care about the platforms they use?

If they only support a (small?) subset of what cURL supports, then it's not exactly a full replacement, and cURL is still needed.

-2

u/ElderberryNo4220 2d ago

It should rewritten in small portions by humans, or if they use language model then at least rewrite in small chunks.

> (Also, of course, those rewrites, being in Rust, do not accommodate the full range ...

Not really a Rust issue but LLVM codegen support for obscure platforms. Either way, gccrs should address some of these concerns.

3

u/tialaramex 1d ago

For curl in particular platforms way outside gccrs are in play for them. Some of this is hardware where you might be surprised there's a C compiler, and certainly forget C++ compilers.

8

u/TerribleFault7929 3d ago

“We'll see,” said the Chinese farmer.

3

u/misuo 3d ago

Well, any unsafe programming language do not look good at the moment. Actually hard to see a future for it.

4

u/hdkaoskd 3d ago

We heard C++ was dead in 2024 when the US government declared all languages must be memory safe.

11

u/johannes1971 3d ago

We heard C++ was dead when Java came out as well. Any day now, those smart JIT compilers are going to use their enhanced knowledge of the runtime environment to finally rush past C++ in terms of performance.

8

u/pjmlp 3d ago

Where is C++ in Android applications, outside games?

Note applications, not the runtime itself.

4

u/Inevitable_Vast6828 1d ago

But you had to say "outside games" LMAO. Why was it even a supported language on Android that REALLY wanted you to use Java? Why does it persist? Think about it.

0

u/pjmlp 12h ago

Yes, because outside games industry, most people have moved on from C and C++ for their userspace applications, and they are perfectly fine using Java, or Kotlin instead on Android.

Just like they are perfectly fine using Objective-C and Swift on Apple platforms, where C++ role is limited to LLVM, Metal Shading Language and IO Kit/Driver Kit, and can be ignored pretty much everywhere else.

Or even on Windows, where Microsoft has been continuously re-focusing on .NET, and Rust of more recently, as the whole UWP/WinRT Windows rewrite with C++ did not took off as Steven Sinofsky planned it to be. Where you can see how much resources MSVC now has for catching up with ISO releases.

If it wasn't for XBox, again games, the amount of resources Microsoft still dedicates to C++ tooling, would probably be much less.

Then you are practically left without other platforms where full applications are still written in 100% C++, instead of a mix of Webviews, Electron, or Qt/QML alongside C++ libraries.

16

u/James20k P2005R0 3d ago

I mean, c++ isn't dead but managed programming languages absolutely ate a massive chunk of c++s former use cases. C# is one of the most popular general application programming languages and is widely used in game development for example

21

u/xp30000 3d ago

Putting aside Rust evangelism (seems it is more fun evangelizing Rust than reading Rust code) why stop at Rust, it's an awkward middle ground. Rust forces the developer (or the AI agent) to fight the borrow checker dealing with lifetimes, Pin, Arc<Mutex<T>>, explicit memory layout to achieve zero-cost abstractions without a garbage collector. GC + formal verification is the way forward with Agents.

For Rust, modern C++ fixes many memory issues that are from C days, is better at compile time metaprogramming, faster to iterate (yup, only Rust can do that LOL). What is left is a very specific niche of system programming and the inability to give talks that you rewrote everything in Rust.

14

u/jeffmetal 3d ago

rust is pretty mature and has shown in real world examples to massively reduce memory safety issue so they picked it. What other language should they rewrite into to prevent these issue ?

6

u/nukethebees 3d ago

What other language should they rewrite into to prevent these issue ?

You could use a systems language with formal verification like SPARK.

5

u/djingo_dango 3d ago

I mean if languages like these show real world maturity then people would use it.

5

u/mx2301 3d ago

Probably not. Spark has seen real-world usage in safety critical areas.

Its just that using these languages is limited to areas where you can get by by only using language constructs that can be proven.

10

u/Hornstinger 3d ago

News flash (and I'm being serious and not facetious): who cares about the AI agent fighting the borrow checker? It is literally no effort for them even with iteration and testing.

Rust is popular because you can fail fast and often and become more resilient quicker.

6

u/puttak 3d ago

You only fight borrow checker in the beginning. Once your proficiency is enough you use it instead of fighting it.

21

u/wyrn 3d ago

Half of Stepanov's generic algorithm library is inexpressible in rust, because of the borrow checker. Clearly it's not a beginner issue.

6

u/foonathan 2d ago

You can express Stepanov style algorithms in Rust, you just can't use them using iterators. What you can do is use something like flux's cursors: https://tristanbrindle.com/flux/

The borrow checker can only prove a limited subset safe, so you have to redesign some things to use that subset. But that's not a big deal.

4

u/wyrn 1d ago

Depends on what you mean by "not a big deal".

https://ceronman.com/blog/my-experience-crafting-an-interpreter-with-rust/

See the section beginning with "The core of a VM is basically a huge loop that increments the program counter". The borrow checker is imposing serious restrictions here, which, if you care about performance (you're doing actual systems programming instead of just glorified applications programming as seems to be the trend of late), will require you to drop to unsafe to get that performance back.

Also, yes, people using rust will often use indices (or generalized indices, like cursors) instead of pointers/references to get around borrow checking issues. But, doing so they'll often just be hand-rolling their own VM, and index errors in this VM will have a similar character to pointer errors. They'll be more benign in the sense they won't incur nasal-demons-launch-the-missiles formal UB, but if you have enough functionality packed in your system they could still do a lot of damage. I'm not convinced that, if safety is a core goal, abandoning borrow checker protections in favor of generalized indices will always be in keeping with that goal.

4

u/jeffmetal 3d ago

I think you mean that algorithm is inexpressible in fully safe rust. Somethings you have to use unsafe for things and in rust your limiting the sections that requires it which is still a step up from having your whole program be potentially unsafe.

6

u/wyrn 3d ago

Yes, that's what I mean, but the promise of safe rust is that unsafe blocks should be few, short, and far between, so they remain auditable by local experts. That promise is much weakened if you have to drop to unsafe every time you want to run some general purpose algorithm like nth_element or make_heap.

(Also, the context here is "fighting the borrow checker"; if I get to use unsafe I can just use pointers for everything and not worry about the borrow checker at all, but that's just C with extra steps).

5

u/ts826848 2d ago

I think there's also the question of precisely how strictly you want/need to adhere to the original API. The borrow checker obviously precludes the multiple-iterator model, but if you're open to merely analogous APIs instead of straight copies I suspect you can get surprisingly far without needing the function calls themselves to involve unsafe.

1

u/tialaramex 2d ago

That promise is much weakened if you have to drop to unsafe every time you want to run some general purpose algorithm like nth_element or make_heap

Although std::nth_element is "generic" it requires that the iterators provided have random access so in practice it's used on slices, which in Rust are just [T] and C++ belatedly standardized std::span in 2020. As a result what you write in Rust isn't some unsafe contortion but a call to select_nth_unstable or, as appropriate select_nth_unstable_by or select_nth_unstable_by_key on the slice. This is a little faster than you'd experience in C++ because of implementation quality, and it actually returns the nth element as well as the partitioned slices on its left and right which for some reason std::nth_element does not provide.

I can't imagine why I would want specifically std::make_heap if I'm not doing a DS&A class. People do seem to love teaching heap sort starting from this algorithm which makes sense, but I can't figure out why I'd want it if I was not implementing a heap sort, maybe you can enlighten me since you described it as "general purpose".

6

u/wyrn 2d ago

so in practice it's used on slices,

Slices require contiguity. Random access iterators do not. In fact, a random access iterator doesn't even need to be backed by a real object in memory (consider for instance sorting the result of a zip).

1

u/tialaramex 2d ago

consider for instance sorting the result of a zip

I'm assuming here you're thinking about a bunch of tuples from a zip algorithm rather than the ZIP compressed file format. But even then while this is technically possible to write in C++ it's annoyingly slow for most cases yet I struggle to think of applications. "This niche usage is difficult instead of just slow" is a very different argument from "General purpose uses need unsafe".

If you wanted to do this (and I don't think most people ever do) you should prefer the same approach as the cached key sorts, sort indices and then re-arrange all the components by index.

Like I said, in practice people apply such algorithms to slices. In fact I poked around github and before I got bored and gave up, all of the dozens of invocations of this function were on slices, the vast majority were on std::vector<T> and some were using actual C-style arrays.

2

u/wyrn 1d ago

it's annoyingly slow for most cases

Annoyingly slow compared to what? Copying the indices somewhere else, sorting the indices, then permuting the original arrays? Maybe in some cases. Do you have a benchmark?

"This niche usage is difficult instead of just slow" is a very different argument from "General purpose uses need unsafe".

"needs" is not quite the right word to use here, but the Stepanov model is more general and expressive than anything expressible in safe rust is not something you can meaningfully disagree with.

Like I said, in practice people apply such algorithms to slices.

I like how you just completely blew past the fact that slices require contiguity.

-2

u/tialaramex 1d ago

Do you have a benchmark?

In C++? No, I was just eyeballing it, but I can probably knock one together tomorrow or Monday if you'd like numbers to look at.

"needs" is not quite the right word to use here

You original claim was about "every time you want to run some general purpose algorithm" which is a practical matter. If Rust really was worse "every time you want to run some general purpose algorithm" that would be a major problem, I agree, but as we saw that's not close to the case. Rust being worse "once in a blue moon when you want to sort zipped iterators" is at most a nuisance.

→ More replies

-8

u/puttak 3d ago

When people say their code cannot be expressible with borrow checker it is either:

  1. Their proficiency it not enough.
  2. There is an actual lifetime issues in the code.

Actually I should not say "when your proficiency is enough". I should say "when you mastered borrow checker" instead since it also took me for a long time to understand how it is actually working. Once you mastered borrow checker you will be able to use unsafe code to bend lifetime and expose it to safe code.

19

u/wyrn 3d ago

That is demonstrably incorrect. Every type system is a tradeoff where one accepts that some correct programs will fail to type check, and the borrow checker in particular disqualifies many correct programs indeed.

-15

u/OutlandishnessNo8034 3d ago

If half of his library is inexpressive in rust then there is problem with the library and most likely lifetime issues and yet to be discovered bugs.

3

u/t_hunger 3d ago

I think she explained it: Hardware is -- thanks to AI -- pretty expensive these days, so they need something with as little overhead as possible.

16

u/jeffmetal 4d ago

I'm sure when profiles land in 3 Years and they address only some of the memory safety issues and none of the lifetime issues it will be good enough for companies to not want to port to rust.

24

u/notthatsocrates 3d ago

Rust evangelism, ignore and carry on.

15

u/UndefinedDefined 3d ago

The reality is that without explicit lifetime annotations C++ will never get safer and companies such as Google would just abandon its use. I mean it makes sense, because Google uses maybe only two containers in the standard library - std::string and std::vector - everything else is in Abseil, because what C++ offers is just plain bad.

13

u/cramert 3d ago

Hey, we use variant, optional, and unique_ptr also! We use them with the unstable libc++ API, but still :)

5

u/James20k P2005R0 3d ago

There's a few things that are really interesting that I think are fun to pick up on:

Adversarial AI Analysis: We utilized specialized LLM prompts to perform "adversarial reviews," asking models to identify subtle behavioral differences between the two codebases that might escape traditional testing.

The validation pipeline proved its value by identifying an edge case in the LZW decoder and—notably—uncovering a pre-existing out-of-bounds write vulnerability introduced by a Google-internal legacy patch to the original C source, which we corrected in the Rust rewrite.

The most significant validation of our approach occurred shortly after the rollout began. A new memory corruption vulnerability—an out-of-bounds heap write—was reported in the original C implementation of giflib (assigned CVE-2026-26740).

(we didn't know about the disclosure or the CVE while working on this)

So we have:

  1. Alleged extensive validation that the two codebases match
  2. It turns out immediately that they either don't match, or the fuzzing was inadequate, as inherently if they had exercised this code path then the Rust code would have terminated. It should raise massive eyebrows if you do not catch security vulnerabilities later discovered in the original code, when porting to a memory safe language if you think your code matches it 1:1 behaviour wise and was tested as such

Its also fascinating to see how ramshackle security is at google. Instead of the random-internal-patch security vulnerability being discovered as part of a dedicated security cleanup effort (and why was that patch never contributed back?), it was caught by one of the classic get-noticed lets-ai-stuff projects. Given that it was catchable, they apparently don't use tooling to do security work on old legacy dependencies like this

Don't get me wrong, I think Rust is cool and concrete memory safety guarantees are important, but if companies like Google put this engineering effort on fuzzing/testing the original code they'd likely have gotten a huge amount of the benefit. Now they have to deal with and maintain FFI bindings (which are really nontrivial if they involve pointers) for a library that's likely to see minimal security work on it again, until the next google engineer wants to give a talk

5

u/t_hunger 3d ago

if companies like Google put this engineering effort on fuzzing/testing the original code they'd likely have gotten a huge amount of the benefit.

Google runs oss-fuzz, one of the biggest fuzzing infrastructures for open source code. Giflib is fuzzed by oss-fuzz.

-1

u/James20k P2005R0 3d ago

I'd be genuinely interested to know why more modern tooling isn't being systematically applied to legacy dependencies like this though, its a lot less work

7

u/t_hunger 3d ago edited 3d ago

You could argue that rewritting the codebase to into a memory safe language is systematically applying modern tooling to legacy dependencies.

1

u/JohnDuffy78 3d ago

wake me up when they start messing with https://github.com/protocolbuffers/protobuf

-5

u/cramert 3d ago

This is your wakeup alarm ⏰

1

u/AccordingWarthog 3d ago edited 3d ago

LLMs being good at exploiting memory safety bugs in C++ code is, at first glance, a strong reason to use a more memory safe language such as Rust. But presumably we shouldn't care about all C++ code, only that which we'd likely deploy. And nowadays all production code gets (or at least should get) reviewed by an LLM.

So what if we narrow our focus to just C++ code that passes review by those same powerful LLMs that can exploit memory bugs? Can't we consider such code to be an approximately "memory-safe" subset of C++? I wonder how such LLM-reviewed C++ stacks up against LLM-reviewed Rust in terms of bug density (memory or otherwise). Are LLMs better/faster at reviewing Rust code than C++ code, like humans are (according to this talk)?

3

u/chaos_pill 3d ago

Are LLMs better/faster at reviewing Rust code than C++ code, like humans are (according to this talk)?

yes, by virtue of the compiler catching a large number of issues in rust. There's a reason most LLM slop is written in rust. Rust put so much effort into things like compiler error messages for humans, only to end up them helping machines somehow.

0

u/13steinj 3d ago

Yeah, I'm not surprised, for better or worse. Top models (with company zero data retention agreements) still fail the tests I give fairly horrendously.

0

u/reini_urban 3d ago

So they rewrote their C++ to Rust in Android. But then they complain about safeties. Why didn't they rewrite it to an actually safe language then?

-3

u/Street_Struggle_598 3d ago

We are going to have agent created languages soonish anyways

-16

u/ezoe 3d ago

C++ was headed to a completely wrong direction. It prioritize metaprogramming, static reflection and silly lightweight pseudo concept expressed as nothing but an extension of template metaprogramming.

These features were invented to reduce the boiler plate code written by human hand. Because humans are bad at writing the boiler plate code.

But with AI coding tool, the cost of writing boiler plate code is now free. The problems C++ tried to solve for the past 2 decades became irrelevant now.

11

u/wyrn 3d ago

"Agents" don't change anything in any meaningful way. The exact same software engineering problems from before exist still, and if anything, their importance is made more pressing now that people have clankers squirting out reams of unreviewed code, not less.

-8

u/ezoe 3d ago

Human review doesn't scale with the speed of AI assisted coding so we will soon give it up.

After all, the upper managements of a company don't bother to review employee's code. Because doing so doesn't scale.

When the performance of AI generated code is on par with human, which already is, mandatory human reviewing doesn't improve the quality of software that much.

We're at the transition phase between traditional hand conding and AI coding. But traditional mind restrict the speed of coding.

10

u/wyrn 3d ago

Human review doesn't scale with the speed of AI assisted coding so we will soon give it up.

And those that take that bargain will understand deeply what Goethe was talking about with that Sorcerer's Apprentice thing.

When the performance of AI generated code is on par with human, which already is

Not even close. Those saying things like that are evaluating the code on very surface level characteristics.

-6

u/ezoe 3d ago

Not even close.

It's more like the quality of human hand coding is horrible. It's a very low bar to reach.

8

u/wyrn 3d ago

Whatever man, you can believe what you want to believe there. But at the end of the day, if you don't separate your system into modular components, fixing one thing will end up breaking something else; if you repeat yourself all over the place instead of building abstractions you virtually guarantee the copies fall out of sync (which you'll waste tokens trying to avoid); if you don't encode useful assumptions and invariants in your types you'll leave your clanker to rediscover/break them, etc. It's literally the exact same problems as always, except with the minor substitution of "tokens" for "developer time".

-1

u/ezoe 2d ago

You are arguing on the completely different topics.

3

u/wyrn 2d ago

C++ was headed to a completely wrong direction. It prioritize metaprogramming, static reflection and silly lightweight pseudo concept expressed as nothing but an extension of template metaprogramming.

These features were invented to reduce the boiler plate code written by human hand. Because humans are bad at writing the boiler plate code.

But with AI coding tool, the cost of writing boiler plate code is now free. The problems C++ tried to solve for the past 2 decades became irrelevant now.

-2

u/ezoe 2d ago

if you don't separate your system into modular components

building abstractions

4

u/wyrn 2d ago

Guess what metaprogramming is used for.

4

u/Minimonium 3d ago

That's just not grounded in actual abilities of frontier models. Code generation by LLM models is actually the least useful thing they can do and requires extreme caution and oversight.

Efficient abstractions are extremely useful to models for the same reasons we liked them before - as it restricts the context bloat, makes everything LLMs do cheaper, ensures predictable, reproducible behavior.

Efficient abstractions for code generation is the same as tools for LLM graphs. And it's a fact that the industry is moving to heavier use of tools.

-2

u/ezoe 3d ago

requires extreme caution and oversight.

So is the human code generation too. Human is also horrible at generating code. If AI code generation became as good as human, which I believe it is right now, that argument doesn't work because they are equally bad.

Efficient abstractions

Current LLM-based AI is very good at reading code. It had been exceeding the performance of human already. But it's not that good at guessing the context that's not present at the code they are reading. Extra abstraction is extra hiding of context.

4

u/Minimonium 3d ago

that argument doesn't work because they are equally bad.

It works exactly as intended - efficient abstractions are as useful to models as they're to people for similar reasons.

Your argument of "extra hiding of context" doesn't work because we do have research supporting the problem of bloated context. The goal is to replace the full context with summaries (which in case of abstractions are publicly stated invariants and guarantees).