<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hacker News: safercplusplus</title><link>https://news.ycombinator.com/user?id=safercplusplus</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Sat, 09 May 2026 16:45:19 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=safercplusplus" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by safercplusplus in "Lib0xc: A set of C standard library-adjacent APIs for safer systems programming"]]></title><description><![CDATA[
<p>> It's in many cases as simple as renaming a file from .c to .cpp.<p>That is rather optimistic, but, for example, scpptool has a feature [1] that auto-converts from C to a subset of C that can (hopefully) be compiled with clang++. If the original C source uses C11 extensions, clang++ seems to generally produce warnings rather than compile errors.<p>> But for writing something from scratch it's better to use Rust.<p>scpptool attempts to make C++ a more viable option by enforcing a memory and data race safe subset using a similar safety strategy.<p>[1] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation2/tree/master#auto-conversion-of-c-to-valid-c" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...</a></p>
]]></description><pubDate>Sat, 02 May 2026 13:10:19 +0000</pubDate><link>https://news.ycombinator.com/item?id=47986106</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=47986106</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47986106</guid></item><item><title><![CDATA[New comment by safercplusplus in "Bugs Rust won't catch"]]></title><description><![CDATA[
<p>I think the concern is that the writing may be on the wall for (the current memory-unsafe version of) Coreutils. Despite the bugs and incompatibilities, Canonical seems to have decided that the memory safety of uutils is worth it. And those two downsides, the bugs and incompatibilities, will likely attenuate quickly, compelling the other distros to follow suit in adopting uutils before long.<p>So the continued popularity of Coreutils might, I think, depend on Coreutil's near-term publicly announced and actual memory safety strategy. As I suggested in my other comment, there are (somewhat nascent) options for memory safety that do not require a rewrite of the code base. (For linux x86_64 platforms, depending on your requirements, that might include the "fanatically compatible" Fil-C.) And given the high profile of Coreutils, there are likely people willing to work with the Coreutils team to help in the deployment of those memory safety options.</p>
]]></description><pubDate>Thu, 30 Apr 2026 05:54:06 +0000</pubDate><link>https://news.ycombinator.com/item?id=47958668</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=47958668</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47958668</guid></item><item><title><![CDATA[New comment by safercplusplus in "Bugs Rust won't catch"]]></title><description><![CDATA[
<p>I don't know if you're aware, but there is a demonstration of wget (a fellow "gnu utility", right?) being auto-translated to a memory-safe subset of C++ [1]. Because the translation essentially does a one-for-one substitution of potentially unsafe C elements with safe C++ counterparts that mirror the behavior, the translation should be much less susceptible to the introduction of new bugs and behaviors in the way a rewrite would be.<p>With a little cleaning-up of the original code, the code translation ends up being fully automatic and so can be used as a build step to produce (slightly slower) memory-safe executables from the original C source.<p>[1] <a href="https://duneroadrunner.github.io/scpp_articles/PoC_autotranslation_of_wget" rel="nofollow">https://duneroadrunner.github.io/scpp_articles/PoC_autotrans...</a></p>
]]></description><pubDate>Wed, 29 Apr 2026 12:52:42 +0000</pubDate><link>https://news.ycombinator.com/item?id=47947632</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=47947632</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47947632</guid></item><item><title><![CDATA[New comment by safercplusplus in "Why Objective-C"]]></title><description><![CDATA[
<p>Interestingly, I recently auto-translated wget from C to a memory-safe subset of C++ [1], which involves the intermediate step of auto-converting from C to the subset of C that will also compile under clang++. You end up with a bunch of clang++ warnings about various things being C11 extensions and not ISO C++ compliant, but it does compile.<p>[1] <a href="https://duneroadrunner.github.io/scpp_articles/PoC_autotranslation_of_wget" rel="nofollow">https://duneroadrunner.github.io/scpp_articles/PoC_autotrans...</a></p>
]]></description><pubDate>Mon, 02 Mar 2026 17:47:23 +0000</pubDate><link>https://news.ycombinator.com/item?id=47221378</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=47221378</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47221378</guid></item><item><title><![CDATA[New comment by safercplusplus in "Ladybird adopts Rust, with help from AI"]]></title><description><![CDATA[
<p>And I might suggest that there's the possibility that the C++ code could end up being more cleanly ported to a memory-safe subset of C++. plug: <a href="https://github.com/duneroadrunner/scpptool/blob/master/approach_to_lifetime_safety_summary.md" rel="nofollow">https://github.com/duneroadrunner/scpptool/blob/master/appro...</a></p>
]]></description><pubDate>Mon, 23 Feb 2026 15:34:54 +0000</pubDate><link>https://news.ycombinator.com/item?id=47123657</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=47123657</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47123657</guid></item><item><title><![CDATA[New comment by safercplusplus in "-fbounds-safety: Enforcing bounds safety for C"]]></title><description><![CDATA[
<p>Plug: In theory you could auto-convert to a memory-safe subset of C++ as a build step. Auto-converted code would have some run-time overhead, but you can mark any performance-sensitive parts of the code to be exempt from conversion. And you get lifetime and type safety too. For full coverage, performance-sensitive parts of the code can be manually converted to the safe subset to minimize overhead. (Interfaces in extern C blocks remain unconverted by default to maintain ABI compatibility.)<p>[1]: <a href="https://duneroadrunner.github.io/scpp_articles/PoC_autotranslation_of_wget" rel="nofollow">https://duneroadrunner.github.io/scpp_articles/PoC_autotrans...</a></p>
]]></description><pubDate>Thu, 19 Feb 2026 18:27:10 +0000</pubDate><link>https://news.ycombinator.com/item?id=47077173</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=47077173</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=47077173</guid></item><item><title><![CDATA[New comment by safercplusplus in "DARPA project for automated translation from C to Rust (2024)"]]></title><description><![CDATA[
<p>As long as we're plugging our projects, I'll mention the scpptool-enforced memory-safe subset of C++. Fil-C would be generally more practical, more compatible and more expedient, but the scpptool-enforced subset of C++ is more directly comparable to Rust.<p>scpptool demonstrates enforcement (in C++) of a subset of Rust's static restrictions required to achieve complete memory and data race safety [1]. Probably most notably, the restriction against the aliasing of mutable references is not imposed "universally" the way it is in (Safe) Rust, but instead is only imposed in cases where such aliasing might endanger memory safety.<p>This is a surprising small set of cases that essentially consists of accesses to methods that can arbitrarily destroy objects owned by dynamic owning pointers or containers (like vectors) while references to the owned contents exist. Because the set is so small, the restriction does not conflict with the vast majority of (lines of) existing C++ code, making migration to the enforced safe subset much easier.<p>The scpptool-enforced subset also has better support for cyclic and non-hierarchical pointer/references that (unlike Safe Rust) doesn't impose any requirements on how the referenced objects are allocated. This means that, in contrast to Rust, there is a "reasonable" (if not performance optimal) one-to-one mapping from "reasonable" code in the "unsafe subset" of C++ (i.e. traditional C++ code), to the enforced safe subset.<p>So, relevant to the subject of the post, this permits the scpptool to have a (not yet complete) feature that automatically converts traditional C/C++ code to the safe subset of C++ [2]. (One that is deterministic and doesn't try to just punt the problem to LLMs.)<p>The problem isn't dedicating public resources to trying to getting LLMs to convert C to Safe Rust after investments in the more traditional approach failed to deliver. The problem is the lack of simultaneous investment in at least the consideration and evaluation of (under-resourced) alternative approaches that have already demonstrated results that the (comparatively well-funded) translate-to-Rust approach thus far hasn't been able to.<p>[1] <a href="https://github.com/duneroadrunner/scpptool/blob/master/approach_to_lifetime_safety_summary.md" rel="nofollow">https://github.com/duneroadrunner/scpptool/blob/master/appro...</a><p>[2] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation2/tree/master/examples/lodepng/lodepng_partial_reoptimization1" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...</a></p>
]]></description><pubDate>Thu, 02 Oct 2025 01:13:40 +0000</pubDate><link>https://news.ycombinator.com/item?id=45445447</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=45445447</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=45445447</guid></item><item><title><![CDATA[New comment by safercplusplus in "Safe C++ proposal is not being continued"]]></title><description><![CDATA[
<p>> Profiles cannot achieve the same level of safety as Rust<p>So the claim is that the scpptool approach[1] can, while remaining closer to traditional C++, and not requiring the introduction of new language elements. Since the scpptool-enforced safe subset of C++ is an actual subset of C++, conforming code continues to build with your existing compiler. It just uses an additional static analyzer to check conformance.<p>For the 90% or whatever of C++ code that is not actually performance sensitive, the associated SaferCPlusPlus library provides drop-in and "one-to-one" safe replacements for unsafe C++ elements (like standard library containers and raw pointers). (For example, if you're worried about potentially invalid vector iterators, you can just replace your std::vector<>s with mse::mstd::vector<>s.) With these elements, most of the safety is enforced in the type system and not reliant on the static analyzer.<p>Conforming implementations of performance-sensitive code would be more restricted and more reliant on the static analyzer for safety enforcement. And sometimes requires the use of library elements, like "borrowing objects", which may not have analogies in traditional C++. But overall, even high-performance conforming code remains very recognizable C++.<p>The claim is that the scpptool approach is a straightforward path to full memory (and data race) safety for C++, and the one that requires the least code migration effort. (And again, as an actual subset of existing C++, not technically dependent on standard committees or compiler vendors for its implementation or deployment.)<p>[1]: <a href="https://github.com/duneroadrunner/scpptool/blob/master/approach_to_lifetime_safety_summary.md" rel="nofollow">https://github.com/duneroadrunner/scpptool/blob/master/appro...</a></p>
]]></description><pubDate>Sat, 13 Sep 2025 21:49:14 +0000</pubDate><link>https://news.ycombinator.com/item?id=45235611</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=45235611</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=45235611</guid></item><item><title><![CDATA[New comment by safercplusplus in "Rust: A quest for performant, reliable software [video]"]]></title><description><![CDATA[
<p>> From what I'm aware of, Rust has poor ergonomics for programs that have non-hierarchical ownership model (ie. not representable by trees)<p>Yeah, non-hierarchical references don't really lend themselves to static safety enforcement, so the question is what kind of run-time support the language has for non-hierarchical references. But here Rust has a disadvantage in that its moves are (necessarily) trivial and destructive.<p>For example, the scpptool-enforced memory-safe subset of C++ has non-owning smart pointers that safely support non-hierarchical (and even cyclical) referencing.<p>They work by wrapping the target object's type in a transparent wrapper that adds a destructor that informs any targeting smart pointers that the object is about to become invalid (or, optionally, any other action that can ensure memory safety). (You can avoid needing to wrap the target object's type by using a "proxy" object.)<p>Since they're non-owning, these smart pointers don't impose any restrictions on when/where/how they, or their target objects, are allocated, and can be used more-or-less as drop-in replacements for raw pointers.<p>Unfortunately, this technique can't be duplicated in Rust. One reason being that in Rust, if an object is moved, its original memory location becomes invalid without any destructor/drop function being called. So there's no opportunity to inform any targeting (smart) pointers of the invalidation. So, as you noted, the options in Rust are less optimal. (Not just "ergonomically", but in terms of performance, memory efficiency, and/or correctness checking.) And they're intrusive. They require that the target objects be allocated in certain ways.<p>Rust's policy of moves being (necessarily) trivial and destructive has some advantages, but it is not required (or arguably even helpful) for achieving "minimal-overhead" memory safety. And it comes with this significant cost in terms of non-hierarchical references.<p>So it seems to me that, at least in theory, an enforced memory-safe subset of C++, that does not add any requirements regarding moves being trivial or destructive, would be a more natural progression from traditional C++.</p>
]]></description><pubDate>Sat, 13 Sep 2025 00:50:31 +0000</pubDate><link>https://news.ycombinator.com/item?id=45228342</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=45228342</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=45228342</guid></item><item><title><![CDATA[New comment by safercplusplus in "Undefined Behavior in C and C++ (2024)"]]></title><description><![CDATA[
<p>Yeah, but C++ now supports "user-defined" annotations which effectively allow you to add the equivalent of any keyword you need, right? (Even if it's not the prettiest syntax.) For example, the scpptool static analyzer supports (and enforces) lifetime annotations with similar meaning to Rust's lifetime annotations.<p>I believe gcc actually does support `__attribute__ ((pure))` to indicate function purity. (I assume it doesn't actually enforce it, but presumably it theoretically could at some point.)</p>
]]></description><pubDate>Wed, 13 Aug 2025 03:43:45 +0000</pubDate><link>https://news.ycombinator.com/item?id=44884467</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=44884467</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44884467</guid></item><item><title><![CDATA[New comment by safercplusplus in "Undefined Behavior in C and C++ (2024)"]]></title><description><![CDATA[
<p>Right. And of course there are still less-performance-sensitive C/C++ applications (curl, postfix, git, etc.) that could have memory-safe release versions.<p>But the point is also to dispel the conventional wisdom that C/C++ is necessarily intrinsically unsafe. It's a tradeoff between safety, performance and flexibility/compatibility. And you don't necessarily need to jump to a completely different language to get a different tradeoff.<p>Fil-C sacrifices some performance for safety and compatibility. The traditional compilers sacrifice some safety for performance and flexibility/compatibility. And scpptool aims to provide the option of sacrificing some flexibility for safety and performance. (Along with the other two tradeoffs available in the same program). The claim is that C++ turns out to be expressive enough to accommodate the various tradeoffs. (Though I'm not saying it's always gonna be pretty :)</p>
]]></description><pubDate>Tue, 12 Aug 2025 11:40:46 +0000</pubDate><link>https://news.ycombinator.com/item?id=44874989</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=44874989</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44874989</guid></item><item><title><![CDATA[New comment by safercplusplus in "Undefined Behavior in C and C++ (2024)"]]></title><description><![CDATA[
<p>A couple of solutions in development (but already usable) that more effectively address UB:<p>i) "Fil-C is a fanatically compatible memory-safe implementation of C and C++. Lots of software compiles and runs with Fil-C with zero or minimal changes. All memory safety errors are caught as Fil-C panics."
"Fil-C only works on Linux/X86_64."<p>ii) "scpptool is a command line tool to help enforce a memory and data race safe subset of C++. It's designed to work with the SaferCPlusPlus library. It analyzes the specified C++ file(s) and reports places in the code that it cannot verify to be safe. By design, the tool and the library should be able to fully ensure "lifetime", bounds and data race safety."
"This tool also has some ability to convert C source files to the memory safe subset of C++ it enforces"</p>
]]></description><pubDate>Tue, 12 Aug 2025 09:08:01 +0000</pubDate><link>https://news.ycombinator.com/item?id=44874034</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=44874034</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44874034</guid></item><item><title><![CDATA[New comment by safercplusplus in "The borrowchecker is what I like the least about Rust"]]></title><description><![CDATA[
<p>Might I suggest that the scpptool-enforced safe subset of C++ has a better solution for such data structures with cyclic or complex reference graphs, which is run-time checked non-owning pointers [1] that impose no restrictions on how or where the target objects are allocated. Unlike indices, they are safe against use-after-destruction, and they don't require the additional level of indirection either.<p>[1] <a href="https://github.com/duneroadrunner/SaferCPlusPlus#norad-pointers">https://github.com/duneroadrunner/SaferCPlusPlus#norad-point...</a></p>
]]></description><pubDate>Sun, 20 Jul 2025 08:53:08 +0000</pubDate><link>https://news.ycombinator.com/item?id=44623171</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=44623171</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44623171</guid></item><item><title><![CDATA[New comment by safercplusplus in "Memory Safe Languages: Reducing Vulnerabilities in Modern Software Development [pdf]"]]></title><description><![CDATA[
<p>Makes sense. But maybe the fact that that post is 4 years old serves to bolster the argument for Fil-C's value proposition. However much people may want to move away from their C code bases, the resources it takes to do so in a timely manner are often not so readily available.</p>
]]></description><pubDate>Mon, 30 Jun 2025 00:53:45 +0000</pubDate><link>https://news.ycombinator.com/item?id=44418074</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=44418074</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44418074</guid></item><item><title><![CDATA[New comment by safercplusplus in "Memory Safe Languages: Reducing Vulnerabilities in Modern Software Development [pdf]"]]></title><description><![CDATA[
<p>Preach it brother! :)<p>Hmm, I take it that the situation is that there are a number of vendors/providers/distros/repos who could be distributing your memory-safe builds, but are currently still distributing unsafe builds?<p>I wonder if an organization like the Tor project [1] would be more motivated to "officially" distribute a Fil-C build, being that security is the whole point of their product. (I'm talking just their "onion router" [2], not (necessarily) the whole browser.)<p>I could imagine that once some organizations start officially shipping Fil-C builds, adoption might accelerate.<p>Also, have you talked to the Ladybird browser people? They seemed to be taking an interested in Fil-C.<p>[1] <a href="https://www.torproject.org/" rel="nofollow">https://www.torproject.org/</a><p>[2] <a href="https://gitlab.torproject.org/tpo/core/tor" rel="nofollow">https://gitlab.torproject.org/tpo/core/tor</a></p>
]]></description><pubDate>Sun, 29 Jun 2025 06:25:24 +0000</pubDate><link>https://news.ycombinator.com/item?id=44410737</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=44410737</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44410737</guid></item><item><title><![CDATA[New comment by safercplusplus in "Pwning the Ladybird Browser"]]></title><description><![CDATA[
<p>This particular memory vulnerability, as I understand it, was a result of a `ReadonlySpan<>` targeting a resizable vector. A simple technique used by the scpptool-enforced safe subset of C++ to address this situation is to temporarily move the contents of the resizable vector into a non-resizable vector [1] and target the span at the non-resizable vector instead.<p>Upon destruction, the non-resizable vector will automatically return the contents back to the original resizable vector. (It's somewhat analogous to borrowing a slice in Rust.)<p>While it wouldn't <i>necessarily</i> prevent you from doing the flawed/buggy thing you were trying to do, it would prevent it from resulting in a memory vulnerability.<p>[1] <a href="https://github.com/duneroadrunner/scpptool#xslta_vector-xslta_fixed_vector-xslta_borrowing_fixed_vector">https://github.com/duneroadrunner/scpptool#xslta_vector-xslt...</a></p>
]]></description><pubDate>Thu, 01 May 2025 11:25:03 +0000</pubDate><link>https://news.ycombinator.com/item?id=43856254</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=43856254</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=43856254</guid></item><item><title><![CDATA[New comment by safercplusplus in "Compiling C to Safe Rust, Formalized"]]></title><description><![CDATA[
<p>Thanks for clarifying. The issue is what code would be rejected for auto-translation, not the correctness of an "accepted" translation (as my comment may have implied).<p>The point of noting that the example translation quietly does the wrong thing, is that that is the reason that it would have to be ("unconditionally") rejected.<p>While the paper does suggest that their example translation would be rejected:<p>> If the original C program further relies on x, our translation will error out<p>note that precisely determining whether or not the program "further relies on x" statically (at compile/translation-time) is, in general, a "Halting Problem". (I.e. Cannot be reliably done with finite compute resources.) So they would presumably have to be conservative and reject any cases were they cannot prove that the program does not "further rely on x". So it's notable that they choose to use a (provisional) translation that has to be rejected in a significant set of false positive cases.<p>And at least on initial consideration, it seems to me that an alternative translation could have, for example, used RefCell<>s or whatever and avoided the possibility of "quietly doing the wrong thing". (And thus, depending on your/their requirements, avoid the need for unconditional rejection.) Now, one might be an a situation where they'd want to avoid the run-time overhead and/or potential unreliability of RefCell<>s, but even then it seems to me that their translation choice does not technically avoid either of those things. Their solution allocates on the heap which has at least some theoretical run-time overhead, and could theoretically fail/panic.<p>Now I'm not concluding here that their choice is not the right one for their undertaking. I'm just suggesting that choosing a (provisional) translation that has to be rejected with significant false positives (because it might quietly do the wrong thing) is at least initially notable. And that there are other solutions out there that demonstrate translation of C to a (high-performance, deterministic) memory-safe language/dialect that don't have the same limitations.</p>
]]></description><pubDate>Sun, 22 Dec 2024 05:27:40 +0000</pubDate><link>https://news.ycombinator.com/item?id=42484570</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=42484570</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42484570</guid></item><item><title><![CDATA[New comment by safercplusplus in "Compiling C to Safe Rust, Formalized"]]></title><description><![CDATA[
<p>And even then, not completely reliably it seems (from Section 2.2):<p>> The coercions introduced by conversion rules can however lead to subtle semantic differences<p>The example they give is this C code:<p><pre><code>    1 uint8_t x[1] = { 0 };
    2 uint8_t *y = x;
    3 *y = 1;
    4 assert(*x == 1); /* SUCCESS */
</code></pre>
getting translated to this (safe) Rust code:<p><pre><code>    1 let x: [u8; 1] = [0; 1];
    2 let mut y: Box<[u8]> = Box::new(x);
    3 y[0] = 1;
    4 assert!(x[0] == 1) /* failure */
</code></pre>
So the pointer (iterator) targeting an existing (stack-allocated) array declared on line 2 gets translated to an owning pointer/Box) targeting a (heap-allocated) new copy of the array. So if the original code was somehow counting on the fact that the pointer iterator was actually targeting the array it was assigned to, the translated code may (quietly) not behave correctly.<p>For comparison, the scpptool (my project) auto-translation (to a memory safe subset of C++) feature would translate it to something like:<p><pre><code>    1 mse::lh::TNativeArrayReplacement<uint8_t, 1> x = { 0 };
    2 mse::lh::TNativeArrayReplacement<uint8_t, 1>::iterator y = x; // implicit conversion from array to iterator
    3 *y = 1;
    4 assert(*x == 1); /* SUCCESS */ // dereferencing of array supported for compatibility
</code></pre>
or if y is subsequently retargeted at another type of array, then line 2 may end up as something like:<p><pre><code>    2 mse::TAnyRandomAccessIterator<uint8_t> y = x; // implicit conversion from array to iterator
</code></pre>
So the OP project may only be converting C code that is already amenable to being converted to safe Rust. But given the challenge of the problem, I can respect the accomplishment and see some potential utility in it.<p>edit: added translation for line 2 in an alternate hypothetical situation.</p>
]]></description><pubDate>Sat, 21 Dec 2024 07:27:34 +0000</pubDate><link>https://news.ycombinator.com/item?id=42478051</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=42478051</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42478051</guid></item><item><title><![CDATA[New comment by safercplusplus in "Why Safety Profiles Failed"]]></title><description><![CDATA[
<p>You might consider experimenting with the scpptool-enforced safe subset of C++ (my project). It should be even less disruptive.<p>[1] <a href="https://github.com/duneroadrunner/scpptool">https://github.com/duneroadrunner/scpptool</a></p>
]]></description><pubDate>Fri, 25 Oct 2024 02:27:52 +0000</pubDate><link>https://news.ycombinator.com/item?id=41941728</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=41941728</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=41941728</guid></item><item><title><![CDATA[New comment by safercplusplus in "Why Safety Profiles Failed"]]></title><description><![CDATA[
<p>In theory it could be auto-converted to a safe subset of C++ [1]. In theory it could be done at build-time, like the sanitizers.<p>[1] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation2">https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...</a></p>
]]></description><pubDate>Fri, 25 Oct 2024 02:17:39 +0000</pubDate><link>https://news.ycombinator.com/item?id=41941698</link><dc:creator>safercplusplus</dc:creator><comments>https://news.ycombinator.com/item?id=41941698</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=41941698</guid></item></channel></rss>