HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
duneroadrunner
SaferCPlusPlus
C++2016–2026
duneroadrunner / SaferCPlusPlus

SaferCPlusPlus

A collection of safe data types that are compatible with, and can substitute for, common unsafe native c++ types

6Distinct people
100Mentions
0Explicit recommenders
426GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A collection of safe data types that are compatible with, and can substitute for, common unsafe native c++ types

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 12:45:45 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year100 dated mentions

Observed mentions: 2016-09-26 19:33:34 UTC to 2026-08-03 12:30:33 UTC.

0102030402016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 21 mentions; 0 submissions, 21 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 40 mentions; 0 submissions, 40 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 14 mentions; 0 submissions, 14 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 18 mentions; 1 submissions, 17 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC21021
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC40040
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC14014
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC18117
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC202
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC000
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC110
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC101
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC303

What Hacker News says

21 sources
Rust may ultimately be the better solution for many or most cases, but right now SaferCPlusPlus[1] may be the more expedient solution for existing C/C++ code bases. > Any time your code takes in untrusted input, it should not be written in an unsafe language. Not just that, but my theory is that untrusted input should only be stored in data types specifically designed for untrusted input [2], and should undergo safety/sanity checks during conversion to more high-performance types. For example, a general rule might be that untrusted integer inputs may only be converted to (high-performance) native integers if their value is less than the square root of the max integer value. [1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus [2] https://github.com/duneroadrunner/SaferCPlusPlus#quarantined...
In Rust is mostly safety
You know, while C++ references are technically unsafe, there is TRegisteredRefWrapper<> [1]. It's a safe version of std::reference_wrapper. Which kind of acts like a reference. So, if you don't mind me using std::strings instead of doubles, your example could be rewritten like mse::mstd::vector<mse::TRegisteredObj<std::string>> data(10); data[0] = "some text"; mse::TRegisteredRefWrapper<std::string> dangling = data[0]; data.resize(100000); try { std::string crashing = dangling; } catch (...) { // expected exception (not a segfault) int q = 3; } Does that work for you? I'm not an expert on std::reference_wrapper, so I'm not sure when it can and cannot substitute for a reference. (Btw, if it's a little verbose for you, there are shorter aliases available. Just search for "shorter aliases" in t
Read the rest
In Rust vs C Pitfalls
Yes, after reading a draft[1] of this document, I suggested to them that they seemed to be insufficiently emphasizing remote execution vulnerabilities (due to invalid memory access). I also pointed out that they neglected to mention Rust and the Clang/LLVM sanitizers. (And SaferCPlusPlus[2] too.) They acknowledged my comments, but it doesn't seem to have had much effect on the document. [1] https://news.ycombinator.com/item?id=12643463 [2] shamelss plug: https://github.com/duneroadrunner/SaferCPlusPlus
In Dramatically Reducing Software Vulnerabilities [pdf]
Well, since they seem to be including collections of elements, each with dependency on one or two files, SaferCPlusPlus[1] could be added to the "data structures" category. It's a collection of safe compatible substitutes for C/C++'s unsafe elements that's generally intended to be used as a whole, but certainly supports cherry picking of individual elements. For example, you could choose to use its safe substitutes for std::vector (and std::array) while foregoing its safe pointer substitutes. The implementation design was a trade-off between minimizing redundancy and minimizing dependencies (and inter-dependencies). Ultimately I decided minimal dependencies would be more appealing to the user. [1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus
In Single-file C/C++ public-domain/open source libraries with minimal dependencies
But that argument doesn't necessarily call for a new language, it only calls for the prohibition of the unsafe elements of the existing language. Intuitively one might assume that potentially unsafe elements (like pointers, references, parts of the standard library, etc.) are so ingrained in C++ that prohibiting them would cripple the language. But actually, C++'s preprocessor is powerful enough that instead of abandoning those potentially unsafe elements, you can instead replace them with safe compatible substitutes. SaferCPlusPlus[1] is a collection of such substitutes. And since the substitute elements are themselves pure C++, you can still use your existing IDEs, debugging tools and SDKs. And the migration of existing code can be done completely incrementally, and much of it won't need to be changed at all. [1] shameless plug: https:/
Read the rest
In The Public Domain C Library
While conventional C++ is a vast improvement in memory safety, it does not, at the moment, fully address the problem. Complete memory safety may be achieved if/when the "Core Guidelines Lifetime Checker"[1] is completed, but in the mean time SaferCPlusPlus[2] can be used to achieve memory safety. SaferCPlusPlus can, of course, be used with C code as well (if you're willing to use a C++ compiler), but will typically be slower than with the corresponding C++ code. [1] https://blogs.msdn.microsoft.com/vcblog/2016/03/31/c-core-gu... [2] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus
In Divided by a common syntax
> But others point out that explicit lifetime annotation is not required to evaluate memory safety [3]. I think you've extrapolated a bit too much from that answer: the code still has to be semantically lifetime-correct, even if the annotations don't need to exist syntactically. Code that wasn't written with Rust-style lifetimes in mind (even if they're not literally written in the code) is unlikely to automatically satisfy the rules statically, so unless SaferCPlusPlus is using a custom compiler that runs Rust-like rules on the code and flags violations, I would expect a lot of such code is only dynamically correct. > [2] https://github.com/duneroadrunner/SaferCPlusPlus#safercplusp.... A few points: - what do you mean by rebindable and non-rebindable references? That is not terminology Rust uses at all, and so it isn't clear what this i
Read the rest
s referring to. - The restriction on multiple aliasing for mutable references is not just to avoid objects being deallocated, it avoids things like iterator invalidation and concurrency problems like data races.
In How to translate a large C project to Rust
For the author: You might consider using SaferCPlusPlus[1] as an intermediate step. Most C code translates easily (and automatably if you're already parsing the C code) into SaferCPlusPlus. This already gives you memory safety, if that is the goal. Next, you can translate to "rustesque" SaferCPlusPlus. SaferCPlusPlus provides elements (pointer types) that (loosely) correspond to Rust elements [2]. The borrow checker's rule of "mutable reference exclusivity" would have to be additionally self-imposed. As you know, this is the hard (difficult to automate) part, but the nice thing is that even partially completed translations/rustifications would remain fully functional (and memory safe). The idea is that "rustified" SaferCPlusPlus code should translate to Rust fairly easily. There seems to be some skepticism of the notion of a "rusty" C/C++
Read the rest
subset that could be easily translated to valid Rust. The claim seems to be that "lifetime annotation" is essential to the way Rust achieves memory safety without run-time overhead. But others point out that explicit lifetime annotation is not required to evaluate memory safety [3]. It just allows the programmer to express additional intent/expectations about object lifetimes. Particularly for an application like CVS, I think translation to SaferCPlusPlus is clearly the more expedient solution. Again, the benefits of (intermediate) translation to SaferCPlusPlus: i) You get memory safety in step 1, and ii) all intermediate steps remain functional and memory safe. [1] https://github.com/duneroadrunner/SaferCPlusPlus [2] https://github.com/duneroadrunner/SaferCPlusPlus#safercplusp... [3] http://stackoverflow.com/questions/31609137/why-are-explicit...
In How to translate a large C project to Rust
> Yes, it's fast, but at what cost? I would gladly give up a massive fraction of my performance for better security and portability - and that's why I program Java. While I agree with the sentiment, a problem with Java is that you're dependent on a runtime environment with a fairly consistent history of vulnerabilities, right? [0][1] > Personal opinion here, but with few exceptions C/C++ are inappropriate languages for starting new development at this point. Maybe, but now there's SaferCPlusPlus [2]. At least it may be a practical option for improving memory safety in many existing code bases. [0] http://www.cvedetails.com/product/19117/Oracle-JRE.html?vend... [1] http://www.cvedetails.com/product/1526/SUN-JRE.html?vendor_i... [2] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus
In Modern C [pdf]
Another choice is SaferCPlusPlus[1] (optionally with a framework like Wt[2]). Using a higher level language (than C) arguably has the drawback of "hiding complexity" in exchange for better productivity and scalability. But languages like Rust and C++ (with SaferCPlusPlus) retain much of the intrinsic performance and memory efficiency of C, without introducing an additional runtime layer. That may allow you to employ extra (diverse) layers of sandboxing/jailing and other security/correctness solutions. [1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus [2] https://www.webtoolkit.eu/wt
In Why pledge(2) or, how I learned to love web application sandboxing

Showing the 15 most recent of 21 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.