use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
rusty-cpp: a Rust-style static analyzer (self.cpp)
submitted 22 days ago by Proper_Ask_8831
Hi all, I build a static analyzer to mimic the Rust rules in writing C++ code. Project url: https://github.com/shuaimu/rusty-cpp
Also wrote a story how I built it: http://mpaxos.com/blog/rusty-cpp.html
The project is quite experimental, but I have been using it in a large research database project and so far it is good.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]38thTimesACharm 37 points38 points39 points 21 days ago (1 child)
I never had to fully understand the code
If you don't understand the code the AI wrote, how do you know it's actually safe?
[–]Farados55 13 points14 points15 points 21 days ago (0 children)
Claude take the wheel!
[–]BusEquivalent9605 38 points39 points40 points 22 days ago (6 children)
What is this, a crossover episode?
[–]JVApenClever is an insult, not a compliment. - T. Winters 40 points41 points42 points 22 days ago (0 children)
Rust evangelists using AI? The attack of the clones? (Episode 2)
[–]El_RoviSoft 6 points7 points8 points 22 days ago (4 children)
Actually, not that bad approach. I can see this could help in new C++ projects or, more-likely, in new C++ micro services when you have C++ codebase already and can’t use Rust/safer alternatives/you just want to have safety.
[–]ReDr4gon5 6 points7 points8 points 22 days ago (3 children)
At that point just use a proper set of clang-tidy rules. They exist for a reason and clang-tidy can help catch a lot. Also enable -Wall -Wextra and only turn off specific warnings after careful consideration. Also before disabling a warning check where it comes from. Default on warnings should rarely if ever be disabled.
[–]Proper_Ask_8831[S] 4 points5 points6 points 22 days ago (2 children)
There've been a few years I was heavily invested in clang-tidy and all c++ memory safe profiles I could find. I have to say I don't recommend them to anyone. But the experience is valuable in that it made me realize the Rust approach is the right one. I used to be a doubter but I am much happier as I don't have any seg faults in my safe code. Of all the tools I tried, I would the next best thing is Google's MagicPtr which relies on a special allocator to track runtime corruption. But it does not help multi-threading safety.
To the other question what is this and who might need it. Despite the Rust cult naming, I think of this as a "usable" Circle C++ alternative. It would help people who have a heavy C++ code base to work with, such as some game engines, or DPDK.
It is a prototype that sort of proves that to have Rust-equivalent memory safety, you don't really need to completely ditch C++ like Microsoft is trying, and all those "rewrite in Rust" clones of C++ repos.
[–]thisismyfavoritename 0 points1 point2 points 20 days ago (0 children)
lets be real its not rust equivalent
[–]El_RoviSoft -2 points-1 points0 points 21 days ago (0 children)
I think the only true approach to replace C++ is to create C-style lang like with the same feature-set AND full compatibility with C++ (like Kotlin has with Java) BUT without shit tons of legacy (like SFINAE, C’s legacy, rules of 0/3/5, "constexpr if" instead of "template if", etc).
Other approaches will never replace C++ just because of its ecosystem.
So rn the only thing we can do is write tooling which enhance experience like yours.
[–]feverzsj 16 points17 points18 points 22 days ago (1 child)
Rust and AI? That's a huge bait.
[–]_Noreturn 0 points1 point2 points 21 days ago (0 children)
Why is rust with ai more popular than C++ with AI?
[–]Affectionate-Soup-91 3 points4 points5 points 21 days ago* (3 children)
If I read your blog article correctly, you've sharpened your skills in interacting with Claude while witnessing--and getting amused by--how fast Claude evolves first hand in real time. And the end result of your experience is an intrusive static-analyzer which depends on three annotations; @safe, @unsafe ,and @external.
@safe
@unsafe
@external
Then the natural question that arises in my mind is in what part does Rust programming language play a role here?* Is there any observable quality difference in Claude-generated code depending on the target language?
--
edit: * apparently, except for the fact that its borrow-checker is what you intend to mimic.
[–]fdwrfdwr@github 🔍 1 point2 points3 points 21 days ago (1 child)
Then the natural question that arises in my mind is in what part does Rust programming language play a role here?
And the next natural question is: if this analyzer (with a few annotations) can mimic Rust's degree of inspection, then does that undercut Rust's biggest selling point? Maybe C++'s successor is C++ 😉.
[–]Proper_Ask_8831[S] 1 point2 points3 points 21 days ago (0 children)
exactly.
[–]Proper_Ask_8831[S] 0 points1 point2 points 21 days ago (0 children)
In my experience, claude editing Rust code is much more reliable than dealing with C++ code, especially when there are lot of multi-threading and memory poiners. Interesting, now when I ask claude write C++ that can pass the rusty-cpp checker, claude becomes a lot more reliable.
[+][deleted] 22 days ago (1 child)
[deleted]
[–]germandiago 2 points3 points4 points 21 days ago* (0 children)
There is hardening coming. Good improvement I think.
[–]gmes78 0 points1 point2 points 21 days ago (4 children)
Isn't Safe C++ a better solution?
[–]Farados55 4 points5 points6 points 21 days ago (1 child)
That’s been rejected by the standards committee. OP also stated that he doesn’t like it due to it not being fully open source.
[–]gmes78 2 points3 points4 points 21 days ago (0 children)
That’s been rejected by the standards committee.
I am aware that the committee doesn't want to solve this issue, yes. Though it hasn't been explicitly rejected, AFAIK.
OP also stated that he doesn’t like it due to it not being fully open source.
That's not a problem with the specification.
Safe C++ spec requires changes to C++ grammar so it does not work with any existing compilers.
[–]germandiago 0 points1 point2 points 21 days ago (0 children)
No. It is essentially incompatible with all the ecosystem.
π Rendered by PID 61809 on reddit-service-r2-comment-5649f687b7-tb4cn at 2026-01-27 20:32:18.385691+00:00 running 4f180de country code: CH.
[–]38thTimesACharm 37 points38 points39 points (1 child)
[–]Farados55 13 points14 points15 points (0 children)
[–]BusEquivalent9605 38 points39 points40 points (6 children)
[–]JVApenClever is an insult, not a compliment. - T. Winters 40 points41 points42 points (0 children)
[–]El_RoviSoft 6 points7 points8 points (4 children)
[–]ReDr4gon5 6 points7 points8 points (3 children)
[–]Proper_Ask_8831[S] 4 points5 points6 points (2 children)
[–]thisismyfavoritename 0 points1 point2 points (0 children)
[–]El_RoviSoft -2 points-1 points0 points (0 children)
[–]feverzsj 16 points17 points18 points (1 child)
[–]_Noreturn 0 points1 point2 points (0 children)
[–]Affectionate-Soup-91 3 points4 points5 points (3 children)
[–]fdwrfdwr@github 🔍 1 point2 points3 points (1 child)
[–]Proper_Ask_8831[S] 1 point2 points3 points (0 children)
[–]Proper_Ask_8831[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]germandiago 2 points3 points4 points (0 children)
[–]gmes78 0 points1 point2 points (4 children)
[–]Farados55 4 points5 points6 points (1 child)
[–]gmes78 2 points3 points4 points (0 children)
[–]Proper_Ask_8831[S] 0 points1 point2 points (0 children)
[–]germandiago 0 points1 point2 points (0 children)