<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: duneroadrunner</title><link>https://news.ycombinator.com/user?id=duneroadrunner</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Sat, 23 May 2026 16:45:05 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=duneroadrunner" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by duneroadrunner in "Ratatoi is a C libary that wraps stdlib's strtol (as atoi does), but it's evil."]]></title><description><![CDATA[
<p>So I don't write much C code these days, but I recently encountered strtol() again and am I mistaken or does the interface also violate const correctness? I mean it takes a <i>const char*</i> as the first parameter and then gives you back a (non-<i>const</i>) <i>char*</i> potentially pointing into the same string, right? Like, does strtol() get a pass because it's old, or is const correctness (still) not generally a concern of C programmers?</p>
]]></description><pubDate>Wed, 21 May 2025 22:38:37 +0000</pubDate><link>https://news.ycombinator.com/item?id=44056979</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=44056979</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=44056979</guid></item><item><title><![CDATA[New comment by duneroadrunner in "How to not rewrite it in Rust"]]></title><description><![CDATA[
<p>Last time I looked at it, c2rust translated from C to unsafe Rust, right? I'll point out a (neglected) project[1] to (partially) auto convert from C to a safe subset of C++. For example, if you need a png encoder/decoder library written in C++, perhaps the safest one is here [2].<p>[1] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...</a><p>[2] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation/tree/master/examples/lodepng/lodepng_translated" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...</a></p>
]]></description><pubDate>Thu, 24 Oct 2019 04:29:42 +0000</pubDate><link>https://news.ycombinator.com/item?id=21341642</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=21341642</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=21341642</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Bounded Integer: Header-only C++ library replaces integers, adds explicit bounds"]]></title><description><![CDATA[
<p>At first glance it seems to be similar to boost::safe_numerics. Are there significant differences?<p><a href="https://github.com/boostorg/safe_numerics" rel="nofollow">https://github.com/boostorg/safe_numerics</a></p>
]]></description><pubDate>Sun, 29 Sep 2019 19:54:09 +0000</pubDate><link>https://news.ycombinator.com/item?id=21109279</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=21109279</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=21109279</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Cone Programming Langauge"]]></title><description><![CDATA[
<p>No, I just read it. SaferCPlusPlus does support all the permission "modes" listed, except the "opaque" one, and transitioning between them (though being stuck with C++'s move semantics). The permissions modes that aren't intrinsic to C++ are enforced at run-time. Objects to be mutably (non-atomically) shared need to be put in an "access control" wrapper, which is kind of like a generalized version of Rust's <i>RefCell<></i> wrapper.<p>As I noted in my original comment, in the "mutex"/"RwLock" case, SaferCPlusPlus allows you to simultaneously hold read-locks and write-locks in the same thread. Which seems natural, since SaferCPlusPlus (and Cone) allows const and non-const pointer/references to coexist in the same thread. But in this case it actually provides increased functionality. It is the functional equivalent of replacing your <i>mutex</i> (and Rust's <i>RwLock</i>) with an "upgradable mutex", which facilitates better resource utilization in some cases, right? It also provides new opportunities to create deadlocks, so the mutex has to detect those.<p>Btw, I am certainly a pot talking to a kettle here, but your "mutex1" urgently needs a better name, right?</p>
]]></description><pubDate>Thu, 04 Apr 2019 22:48:24 +0000</pubDate><link>https://news.ycombinator.com/item?id=19577870</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19577870</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19577870</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Cone Programming Langauge"]]></title><description><![CDATA[
<p>> I wrote a post about it.[1]<p>I just read it, and I thought it was great. I had a similar, if perhaps not-as-well-thought-out, reaction to Manish's (I agree, excellent) post. I think SaferCPlusPlus basically implements the permission mechanisms you listed in the summary (as well as the preceding "Race-Safe Strategies" post). (Although with some of the restrictions enforced at run-time rather than compile-time.) Looking forward to Cone 1.0. :)<p>p.s.: btw, the link on your post to the preceding "Race-Safe Strategies" post is broken</p>
]]></description><pubDate>Thu, 04 Apr 2019 09:14:16 +0000</pubDate><link>https://news.ycombinator.com/item?id=19570428</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19570428</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19570428</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Cone Programming Langauge"]]></title><description><![CDATA[
<p>> Cone actually does support Rust-like, lifetime-constrained borrowed references<p>Ah, so kind of a super-set of Rust functionality. Presumably these would require a "borrow checker" or equivalent? Is that already implemented? So how do you address the safety of, say, taking a reference to an element in a (resizable) vector? Rust's "exclusivity of mutable references" restriction intrinsically makes the vector immutable while the borrowed reference exists, but do I understand that Cone doesn't have that restriction? The "C++ lifetime profile checker", on the other hand, makes the vector non-resizable (but leaves the data mutable).<p>> A key requirement I have placed on references (vs. pointers) is that you can always de-reference them and get a valid value<p>SaferCPlusPlus provides both a pointer that throws an exception if you attempt an invalid memory access (though it could just as easily return an <i>optional<></i>, and you can always query if the target is valid), and one that terminates the program if its target is ever deallocated prematurely (and thus (technically) satisfies your criteria). (The latter has less/minimal overhead.)<p>> A Cone programmer would need to use raw pointers to throw off the shackles of lifetime constraints<p>Or reference counting pointers or GC, right? The features needed to implement the pointers I mentioned is either support for calling a destructor on move operations or the ability to make an object non-movable, and, support for copy constructors or the ability to make an object uncopyable. Does/could your language support some combination of those features?<p>I explain the reason the pointers are important in an article called "Implications of the Core Guidelines lifetime checker restrictions" [1]. Specifically, I give an example of reasonable C++ code [2] that historically had no corresponding efficient implementation in Safe Rust. (I think it's still the case, but I haven't fully investigated the implications of Rust's new "pinning" feature.) It can, however, be implemented in a memory safe way using the SaferCPlusPlus pointers in question [3]. Basically the example just temporarily inserts a reference to a (stack allocated) local variable into a list (or whatever dynamic container), given that the local variable does not outlive the container.<p>> especially given that borrowed references and raw pointers are both able to point inside an allocated object<p>SaferCPlusPlus has the equivalent of "borrowed references"[4] (though even more restricted until C++'s "borrow checker" (the aforementioned "lifetime profile checker") is completed), and they can safely point "inside" (allocated) objects. Note that the second safe pointer type (the one that potentially terminates the program), is a "strong" pointer, and there is a simple mechanism for obtaining a "borrowed reference" from a strong pointer [5]. And from there, a simple mechanism for obtaining a reference to an (interior?) member [6].<p>The other pointer (the one that potentially throws an exception) would be considered a "weak" pointer, and you cannot obtain a "borrowed reference" directly from a weak pointer. But often, the weak pointer is used to target an object that can yield a borrowed reference (like a strong pointer, for example), or a borrowed reference directly.<p>> all the best with getting others to learn about and adopt your language.<p>You too :) I can see the appeal of this sort of clean, flexible language. But in the case of SaferCPlusPlus the goal is not necessarily (just) for programmers to adopt it. In part it's maybe a demonstration (to language designers such as yourself :) of a set of language elements that use run-time safety enforcement mechanisms but are a little more flexible than (and might be a good / (unintuitively) needed complement to) their counterparts that rely on strictly compile-time safety enforcement.<p>Oh and if you do get around to checking out SaferCPlusPlus in more depth, apologies for the inadequate documentation in advance. Feel free to post any questions you might have. :)<p>[1] <a href="https://github.com/duneroadrunner/misc/blob/master/201/8/Jul/implications%20of%20the%20lifetime%20checker%20restrictions.md" rel="nofollow">https://github.com/duneroadrunner/misc/blob/master/201/8/Jul...</a><p>[2] <a href="https://github.com/duneroadrunner/misc/blob/master/201/8/Jul/implications%20of%20the%20lifetime%20checker%20restrictions.md#snippet-4" rel="nofollow">https://github.com/duneroadrunner/misc/blob/master/201/8/Jul...</a><p>[3] <a href="https://github.com/duneroadrunner/misc/blob/54204445bc099987cef6246db5b8b1ce3b4e8e06/201/8/Jul/implications1.cpp#L93" rel="nofollow">https://github.com/duneroadrunner/misc/blob/54204445bc099987...</a><p>[4] <a href="https://github.com/duneroadrunner/SaferCPlusPlus#txscopeitemfixedpointer" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#txscopeitem...</a><p>[5] <a href="https://github.com/duneroadrunner/SaferCPlusPlus#make_xscope_strong_pointer_store" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#make_xscope...</a><p>[6] <a href="https://github.com/duneroadrunner/SaferCPlusPlus#make_pointer_to_member_v2" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#make_pointe...</a></p>
]]></description><pubDate>Thu, 04 Apr 2019 04:39:44 +0000</pubDate><link>https://news.ycombinator.com/item?id=19569372</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19569372</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19569372</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Cone Programming Langauge"]]></title><description><![CDATA[
<p>> I only post to HN to plug my project called SaferCPlusPlus<p>From this account, yes. Too much? Sorry, (you can see) I haven't gotten much feedback. Or is having a separate, project-specific account in itself not cool?<p>> not ever to talk about the submitted article.<p>I try to post/plug only when I think it's relevant. I think. For example, in the "gmm.pdf" linked in the comment I responded to, the author says that specific types of references can only target objects owned/allocated by the associated allocator. There is no available reference type that can target objects from different allocators. References in Rust, for example, can target any object regardless of how they were allocated, but imposes strict restrictions that the author implies he's trying to avoid.<p>So I tried to point out that SaferCPlusPlus has pointer types that can safely target objects allocated by different allocators and do not have the strict restrictions of Rust's references. As far as I know, these types of pointers are (still) unique to SaferCPlusPlus, and I assume I am one of a few people who is familiar with these pointers. But there's nothing proprietary about them. If the author is constructing a language with a goal of flexibility wrt to memory safety, I thought he might consider whether such pointer/reference types might be compatible with his language design. I think they unquestionably increase flexibility (while maintaining memory safety).</p>
]]></description><pubDate>Thu, 04 Apr 2019 01:03:00 +0000</pubDate><link>https://news.ycombinator.com/item?id=19568523</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19568523</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19568523</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Cone Programming Langauge"]]></title><description><![CDATA[
<p>If maximum (or just more) flexibility wrt memory safety is the goal, I might suggest the author take a look at SaferCPlusPlus. In particular, it supports memory safe pointer/references[1][2] that can target objects associated with different allocators (including stack allocated objects) without, as the author desires, imposing the "sometimes confining" restrictions that Rust does. And in terms of data race safety, it allows you to hold "read-lock" and "write-lock" pointer/references simultaneously in the same thread [3], which adds a little extra functionality (and maybe convenience).<p>[1] shameless plug: <a href="https://github.com/duneroadrunner/SaferCPlusPlus#registered-pointers" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#registered-...</a><p>[2] <a href="https://github.com/duneroadrunner/SaferCPlusPlus#norad-pointers" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#norad-point...</a><p>[3] <a href="https://github.com/duneroadrunner/SaferCPlusPlus#tasyncsharedv2readwriteaccessrequester" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#tasyncshare...</a></p>
]]></description><pubDate>Wed, 03 Apr 2019 22:27:58 +0000</pubDate><link>https://news.ycombinator.com/item?id=19567770</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19567770</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19567770</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Achieving Safety Incrementally with Checked C"]]></title><description><![CDATA[
<p>> What guarantees that the "while" loop will not run away and take "data" outside the array bounds?<p>What do you mean "the array bounds"? The code is memory safe. "data" is an iterator that knows exactly what array/container it's pointing to, and that container knows its own size. Dereferences are bounds checked (by default).<p>This translated code is not intended to be performance optimal. The translator does not add, remove or rearrange any of the original source code elements, it simply replaces some of them with macros that are defined as functionally equivalent, memory safe C++ substitutes for the original element. Doing it this way has the benefit of allowing you to "disable" the memory safety mechanisms by reverting the macro definitions to the original (unsafe) elements.<p>I have not yet gotten around to addressing performance of the translated code. In order to preserve the ability to revert back to pure C code, there would need to be an additional set of macros (like maybe an "array view" macro) that could be mapped to their (safe) high performance C++ counterparts but that would be more restricted in their usage.<p>But at this point I think the value of that is questionable. If you need your code to be memory safe and high performance, the most expedient thing to do is to just accept the translated code as C++ code (or SaferCPlusPlus code) and re-optimize the performance bottlenecks as idiomatic SaferCPlusPlus code. SaferCPlusPlus is, along with Rust, the fastest [1] option for memory (and data race) safe programming.<p>And if you don't like the C++ language as whole, just (define and) stick to a subset you're comfortable with, right? I mean, (I think your proposal is fine as an extension of C, but) I don't see the point in extending the C language with things like views/slices/spans, when the C language is already extended with those. It's called C++ (or some subset thereof) right? And with C++ you can solve the memory (and data race) issues much more comprehensively and performantly (if that's a word :) than with any extension to C. No?<p>[1] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-BenchmarksGame" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-BenchmarksG...</a></p>
]]></description><pubDate>Tue, 19 Mar 2019 19:59:34 +0000</pubDate><link>https://news.ycombinator.com/item?id=19435089</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19435089</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19435089</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Achieving Safety Incrementally with Checked C"]]></title><description><![CDATA[
<p>Thanks for noticing :) It's been quite a while since I worked on the code, but I believe that the translator intentionally left types declared as "char {star}" unmodified assuming that they were being used as strings [1] rather "regular" array buffers. I'm guessing that dealing with strings would have been a lot more work because it would require providing safe compatible replacements for all the standard C library string functions.<p>I think you should find that array buffers of other types, like "<i>unsigned</i> char" or "const unsigned char", and their associated pointer iterators are translated to their corresponding macros. I'd be interested if you find otherwise. If you're interested, the relevant code for the translator is in the "safercpp" subdirectory [2]. It's not super-well commented so if you have any questions feel free to post them in the "issues" section of the repository.<p>[1] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation/blob/cf72155bbc7cf7f9e9288c22cbb332c9d2f5e16f/mutator_snapshot/safercpp/safercpp-arr.cpp#L1439-L1440" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...</a><p>[2] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation/tree/cf72155bbc7cf7f9e9288c22cbb332c9d2f5e16f/mutator_snapshot/safercpp" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...</a></p>
]]></description><pubDate>Tue, 19 Mar 2019 06:27:44 +0000</pubDate><link>https://news.ycombinator.com/item?id=19428540</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19428540</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19428540</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Achieving Safety Incrementally with Checked C"]]></title><description><![CDATA[
<p>> "Unknown" ranges from 49% to 76%.<p>Yeah, this is interesting. They're saying they can't determine whether a pointer targets an array buffer or not? Perhaps they might want to take a look at the (long neglected) "C to SaferCPlusPlus" translator[1] which can do this. (It was an unexpectedly taxing undertaking though.) It converts C arrays and allocated buffers used as arrays into memory safe implementations of <i>std::array<></i>s and <i>std::vector<></i>s, so failure to properly identify them would generally result in output code that wouldn't compile.<p>The examples they give of problematic code in the paper:<p><pre><code>    void f(int* a) {
        *(int**)a = a;
    }
</code></pre>
and<p><pre><code>    f1(((int*) 0x8f8000));
</code></pre>
don't strike me as the kind you would often encounter in real-world code.<p>> The syntax they use is rather clunky<p>The output code of the "C to SaferCPlusPlus" translator replaces the types and declarations with macros[2] that can be redefined with a compile-time directive to either use the safe C++ implementation, or revert to the original unsafe native C implementation. The argument being that using macros instead of custom syntax makes the source code more versatile. And existing C programmers already "get" macros.<p>[1] shameless plug: <a href="https://github.com/duneroadrunner/SaferCPlusPlus-AutoTranslation" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-AutoTransla...</a><p>[2] <a href="https://github.com/duneroadrunner/SaferCPlusPlus/blob/master/mselegacyhelpers.h" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus/blob/master...</a></p>
]]></description><pubDate>Tue, 19 Mar 2019 00:03:24 +0000</pubDate><link>https://news.ycombinator.com/item?id=19426655</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19426655</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19426655</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Achieving Safety Incrementally with Checked C"]]></title><description><![CDATA[
<p>For cases where the platform supports C++ (and its standard library), there is kind of a corresponding "checked C++"[1] that also supports the "completely incremental" migration approach. (And obviously supports "array view" type objects.)<p>[1] shameless plug: <a href="https://github.com/duneroadrunner/SaferCPlusPlus#safercplusplus-versus-checked-c" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#safercplusp...</a></p>
]]></description><pubDate>Mon, 18 Mar 2019 21:26:11 +0000</pubDate><link>https://news.ycombinator.com/item?id=19425486</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19425486</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19425486</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Why I rewrote the mesh generator of Dust3D from Rust to C++"]]></title><description><![CDATA[
<p>Oh yeah, there are plenty of reasons to prefer Rust over C++. I think it's also reasonable to favor Rust's "exclusivity of mutable references" default as a matter of personal preference. I'm just not sure the formal or technical argument has yet been made that universally applying that restriction is necessarily the "better" default overall.</p>
]]></description><pubDate>Fri, 15 Mar 2019 20:27:01 +0000</pubDate><link>https://news.ycombinator.com/item?id=19403961</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19403961</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19403961</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Why I rewrote the mesh generator of Dust3D from Rust to C++"]]></title><description><![CDATA[
<p>Yes, It's hard to deny the intuitive appeal, but what's notably missing from that blog post, and seemingly any other article about it, is a consideration of the cost/downsides of universal imposition of the "exclusivity of mutable references" restriction. Rust provides the <i>RefCell</i> wrapper to essentially circumvent the restriction on demand, but i) that also essentially circumvents the "invariant protection" benefits of the policy, and ii) you can just as easily use an equivalent wrapper[1] in C++ to impose the same restriction. At which point the difference between Rust and C++ just kind of becomes which policy do you want to be the zero-overhead default.<p>I mean you could imagine a hypothetical future scenario where it is demonstrated that the optimizers are good enough to essentially eliminate the run-time cost of <i>RefCell</i> wrappers, and a lot of Rust programmers just start wrapping everything with <i>RefCell</i>s by default.<p>[1] shameless plug: <a href="https://github.com/duneroadrunner/SaferCPlusPlus#exclusive-writer-objects" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#exclusive-w...</a></p>
]]></description><pubDate>Fri, 15 Mar 2019 16:22:11 +0000</pubDate><link>https://news.ycombinator.com/item?id=19401103</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19401103</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19401103</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Why I rewrote the mesh generator of Dust3D from Rust to C++"]]></title><description><![CDATA[
<p>Rust's usability is advancing, but I'll note that so are C++'s memory safety facilities. Arguably, modern C++ programming is becoming intrinsically more safe than more traditional coding styles (though arguably the use of <i>string_view</i>s and <i>span</i>s outside of function parameters is a step backwards), but progress is also being made on the lifetime profile checker (C++'s borrow checker analogue), and there are libraries[1] that allow you avoid potentially unsafe C++ elements, to the degree that (memory and data race) safety is a priority.<p>At present, C++ is significantly lacking in safety enforcement tooling and "community enthusiasm" for memory safety compared to Rust. But to me, it is not obvious that that will be the case indefinitely. It's even plausible that Rust and C++ will sufficiently converge in flexibility and safety that at some point automated translation between the two languages will be a thing.<p>At the moment, I think the main relevant difference in fundamental (as opposed to not-yet-available tooling or whatever) capability between the two languages is Rust's lack of support for move constructors/destructors. I think it prevents the safe, efficient, unintrusive, robust implementation of a small but significant set of algorithms / data structures.<p>But I guess my point is that I think that C++, and its existing codebases, are not necessarily condemned indefinitely to be memory unsafe in the way they have been historically. And that could be a factor that contributes to the justification of deciding to continue to use C++ in some cases.<p>[1] shameless plug: <a href="https://github.com/duneroadrunner/SaferCPlusPlus" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus</a></p>
]]></description><pubDate>Fri, 15 Mar 2019 15:02:17 +0000</pubDate><link>https://news.ycombinator.com/item?id=19400295</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19400295</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19400295</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Serious Chrome zero-day"]]></title><description><![CDATA[
<p>ArrayBufferBuilder isn't, but DOMArrayBuffer seems to be a GC managed type [1], right? And, before the patch, the DOMArrayBuffer held a "refcounting pointer" potentially targeting raw_data_'s reference counted ArrayBuffer, right? I don't see any immediately apparent use-after-free with this, so I assume raw_data_'s ArrayBuffer is being messed with elsewhere? As someone who worked on the code, do you have an idea/hunch about where the invalid memory access actually occurs?<p><a href="https://github.com/chromium/chromium/blob/ba9748e78ec7e9c0d594e7edf7b2c07ea2a90449/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h#L20-L22" rel="nofollow">https://github.com/chromium/chromium/blob/ba9748e78ec7e9c0d5...</a></p>
]]></description><pubDate>Thu, 07 Mar 2019 23:46:43 +0000</pubDate><link>https://news.ycombinator.com/item?id=19333822</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19333822</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19333822</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Serious Chrome zero-day"]]></title><description><![CDATA[
<p>Ug. After closer inspection, it looks like those particular raw pointers seem to be managed by a garbage collector. (Specifically, the "Blink GC" [1].) As others have pointed out, this particular bug may not actually be a C++ issue. (Or at least not a typical one.)<p>[1] <a href="https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/platform/heap/BlinkGCDesign.md" rel="nofollow">https://chromium.googlesource.com/chromium/src/+/master/thir...</a></p>
]]></description><pubDate>Thu, 07 Mar 2019 12:41:41 +0000</pubDate><link>https://news.ycombinator.com/item?id=19327518</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19327518</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19327518</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Serious Chrome zero-day"]]></title><description><![CDATA[
<p>They are working on it. The analogue to the borrow checker in C++ is called the "lifetime profile checker" and (an incomplete version) is included in MS Visual C++, but last time I checked (in January) it seemed to still have too many false positives to be practical.<p>In the mean time, I think "the minimum necessary changes" to achieve memory and data race safety is to replace all your unsafe C++ elements (pointers, arrays, vectors, string_views, etc.) with compatible substitutes from the SaferCPlusPlus library [1]. You don't even need to replace them all at once. You can replace them incrementally and your code will continue to compile and run throughout the process. And where needed, maintain maximal performance as well [2].<p>[1] shameless plug: <a href="https://github.com/duneroadrunner/SaferCPlusPlus" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus</a><p>[2] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-BenchmarksGame" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-BenchmarksG...</a></p>
]]></description><pubDate>Thu, 07 Mar 2019 06:30:48 +0000</pubDate><link>https://news.ycombinator.com/item?id=19325979</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19325979</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19325979</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Serious Chrome zero-day"]]></title><description><![CDATA[
<p>I suggest that the most expedient (cheapest) language to migrate the existing code base to would be a memory safe subset of C++ [1]. In practice most of the safety benefit could be obtained from a just a partial migration. Specifically, just banning raw pointers/views/spans and non-bounds-checked arrays and vectors. From a quick glance at the code in the (quite small) patch diff, the code in question includes:<p><pre><code>    DOMArrayBuffer* result = DOMArrayBuffer::Create(raw_data_->ToArrayBuffer());
    
    ...
    
        raw_data_.reset();
    
    ...
    
   return result;
</code></pre>
I'd imagine the effort/time/money it would take to replace those raw pointers with memory safe substitutes [2][3][4] (and enforce the ban going forward) would be relatively modest. Performance shouldn't be an issue [5].<p>[1] shameless plug: <a href="https://github.com/duneroadrunner/SaferCPlusPlus" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus</a><p>[2] <a href="https://github.com/duneroadrunner/SaferCPlusPlus#registered-pointers" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#registered-...</a><p>[3] <a href="https://github.com/duneroadrunner/SaferCPlusPlus#norad-pointers" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#norad-point...</a><p>[4] <a href="https://github.com/duneroadrunner/SaferCPlusPlus#scope-pointers" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#scope-point...</a><p>[5] <a href="https://github.com/duneroadrunner/SaferCPlusPlus-BenchmarksGame" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus-BenchmarksG...</a></p>
]]></description><pubDate>Thu, 07 Mar 2019 02:01:41 +0000</pubDate><link>https://news.ycombinator.com/item?id=19324963</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19324963</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19324963</guid></item><item><title><![CDATA[New comment by duneroadrunner in "Fearless Concurrency: Clojure, Rust, Pony, Erlang and Dart"]]></title><description><![CDATA[
<p>I'll just mention that if you're using C++, the SaferCPlusPlus library[1] supports a data race safe subset of C++, vaguely analogous to Rust's.<p>[1] shameless plug: <a href="https://github.com/duneroadrunner/SaferCPlusPlus#multithreading" rel="nofollow">https://github.com/duneroadrunner/SaferCPlusPlus#multithread...</a></p>
]]></description><pubDate>Mon, 25 Feb 2019 11:51:46 +0000</pubDate><link>https://news.ycombinator.com/item?id=19244940</link><dc:creator>duneroadrunner</dc:creator><comments>https://news.ycombinator.com/item?id=19244940</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=19244940</guid></item></channel></rss>