<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: dbremner</title><link>https://news.ycombinator.com/user?id=dbremner</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Tue, 21 Apr 2026 04:42:51 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=dbremner" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by dbremner in "Ask HN: What are you working on? (March 2025)"]]></title><description><![CDATA[
<p>I'm developing an application that utilizes a genetic algorithm to optimize compilation flags.</p>
]]></description><pubDate>Wed, 02 Apr 2025 12:38:49 +0000</pubDate><link>https://news.ycombinator.com/item?id=43555959</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=43555959</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=43555959</guid></item><item><title><![CDATA[New comment by dbremner in "Ask HN: What are you working on? (February 2025)"]]></title><description><![CDATA[
<p>I'm rewriting a suite of network applications from C++ to Rust as a learning exercise. It's a long obsolete and obscure protocol, so the results aren't particularly useful, but it's been a good introduction to the language.</p>
]]></description><pubDate>Tue, 25 Feb 2025 02:06:46 +0000</pubDate><link>https://news.ycombinator.com/item?id=43167250</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=43167250</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=43167250</guid></item><item><title><![CDATA[New comment by dbremner in "The two factions of C++"]]></title><description><![CDATA[
<p>This is a 30+ year-old codebase that originally started as pre-ANSI C. The design tradeoffs were very different at the time. I've managed to compile it as C++23 with unreasonably high warning levels, and it's now warning-free. However, there are still many unresolved issues.<p>One notable limitation is the use of a <i>SIGINT</i> handler implemented with <i>setjmp</i>/<i>longjmp</i>, which reduces the effectiveness of RAII.<p>Regarding <i>textToStr</i>, there were four instances where it was called twice in the same expression. To avoid potential problems, I replaced these calls with a temporary <i>std::string</i> to store the result of the first call before the second is made. In hindsight, none of these cases likely would have caused issues, but I preferred not to take risks. The <i>SigIntGuard</i> ensures that the <i>std::string</i> destructor runs even if a <i>SIGINT</i> occurs:<p><pre><code>    {
        SigIntGuard guard;
        std::string const member{textToView(textOf(fst(b)))};
        std::print(errorStream, R"(No member "{}" in class "{}")", member, textToView(klass(c).text));
    }</code></pre></p>
]]></description><pubDate>Tue, 26 Nov 2024 23:31:03 +0000</pubDate><link>https://news.ycombinator.com/item?id=42251306</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=42251306</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42251306</guid></item><item><title><![CDATA[New comment by dbremner in "The two factions of C++"]]></title><description><![CDATA[
<p>Here is a real safety issue that I found and fixed a couple weeks ago. This is an ancient language runtime which originally ran on MS-DOS, Amiga, Atari, and at least a dozen now-discontinued commercial Unices. I've been porting it to 64-bit OSes as a weekend hack. While this particular issue is unlikely to appear in modern applications, a similar pattern might manifest today as a <i>use-after-free</i> error with <i>std::string_view</i> or an invalid iterator.<p>Background:<p><pre><code>    typedef int Text; 
</code></pre>
The Text type is used to encode different kinds of string-like values. Negative values represent a generated dictionary. Valid indexes in the string intern table (<a href="https://en.wikipedia.org/wiki/String_interning" rel="nofollow">https://en.wikipedia.org/wiki/String_interning</a>) represent a stored string. Other values represent generated variable names.<p>const char *textToStr(Text t) - This takes a Text value and returns a pointer to a null-terminated string. If <i>t</i> is a string intern index, then it returns a pointer to the stored string. If <i>t</i> represents either a generated dictionary or generated variable name, then it calls snprintf on a static buffer and returns the buffer's address.<p>Problem:<p>The use of a static buffer in <i>textToStr</i> introduces a temporal safety issue when multiple calls are made in the same statement. Here’s an excerpt from a diagnostic error message, simplified for clarity:<p><pre><code>    printf(stderr, "Invalid use of \"%s\" with \"%s\"",
                textToStr(e),
                textToStr(s));
</code></pre>
If both <i>e</i> and <i>s</i> are generated dictionaries or variables, then each call to <i>textToStr</i> overwrites the static buffer used by the other. Since the evaluation order of function arguments in C++ is undefined, the result is unpredictable and depends on the compiler and runtime.</p>
]]></description><pubDate>Mon, 25 Nov 2024 18:38:56 +0000</pubDate><link>https://news.ycombinator.com/item?id=42238820</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=42238820</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=42238820</guid></item><item><title><![CDATA[New comment by dbremner in "C and C++ prioritize performance over correctness"]]></title><description><![CDATA[
<p>I'm not sure about static analyzers, but here are the clang warnings I use for my personal C++20 projects. You will get an enormous number of warnings from typical C++ code. I fix all of them, but doubt it would make sense to do so in a commercial environment.<p>-Weverything - this enables <i>every</i> clang warning<p>-Wno-c++98-compat - warns about using newer C++ features<p>-Wno-c++98-compat-pedantic - warns about using newer C++ features<p>-Wno-padded - warns about alignment padding. I optimize struct layout, so this warning only reports on cases I couldn't resolve.<p>-Wno-poison-system-directories - I'm not cross-compiling anything.<p>-Wno-pre-c++20-compat-pedantic - warns about using newer C++ features</p>
]]></description><pubDate>Fri, 18 Aug 2023 18:46:52 +0000</pubDate><link>https://news.ycombinator.com/item?id=37180297</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=37180297</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=37180297</guid></item><item><title><![CDATA[New comment by dbremner in "Go 1.17 Release Notes"]]></title><description><![CDATA[
<p><a href="https://github.com/dbremner/cake" rel="nofollow">https://github.com/dbremner/cake</a> is a 16-bit Windows 1.0 application that I ported to Win64; most of the changes weren't required.</p>
]]></description><pubDate>Tue, 17 Aug 2021 20:49:07 +0000</pubDate><link>https://news.ycombinator.com/item?id=28214678</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=28214678</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=28214678</guid></item><item><title><![CDATA[New comment by dbremner in "It is 2018 and this error message is a mistake from 1974"]]></title><description><![CDATA[
<p><a href="https://github.com/dbremner/cake" rel="nofollow">https://github.com/dbremner/cake</a> is a 16-bit Windows 1.0 application that I ported to Win64; most of the changes weren't required.</p>
]]></description><pubDate>Tue, 08 Jun 2021 18:44:17 +0000</pubDate><link>https://news.ycombinator.com/item?id=27439186</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=27439186</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=27439186</guid></item><item><title><![CDATA[New comment by dbremner in "Reviving Old X Code"]]></title><description><![CDATA[
<p>Porting 16-bit assembly is harder but porting C code from Win16 to Win32 is pretty easy.<p><a href="https://github.com/dbremner/cake" rel="nofollow">https://github.com/dbremner/cake</a> is a 16-bit Windows 1.0 application that I ported to Win64; most of the changes weren't required.</p>
]]></description><pubDate>Mon, 04 Jan 2021 21:49:20 +0000</pubDate><link>https://news.ycombinator.com/item?id=25638674</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=25638674</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=25638674</guid></item><item><title><![CDATA[Implementations for Gray code encoding and decoding (2019)]]></title><description><![CDATA[
<p>Article URL: <a href="https://leni536.github.io/2019/09/26/Gray_encode_decode.html">https://leni536.github.io/2019/09/26/Gray_encode_decode.html</a></p>
<p>Comments URL: <a href="https://news.ycombinator.com/item?id=23641645">https://news.ycombinator.com/item?id=23641645</a></p>
<p>Points: 2</p>
<p># Comments: 0</p>
]]></description><pubDate>Thu, 25 Jun 2020 15:13:15 +0000</pubDate><link>https://leni536.github.io/2019/09/26/Gray_encode_decode.html</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=23641645</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=23641645</guid></item><item><title><![CDATA[New comment by dbremner in "The most surprising Unix programs"]]></title><description><![CDATA[
<p>I don't think it has all of them, but [0] is a tarball from Research Unix that has some Writer's Workbench source code.<p>The files are in cmd/wwb.<p>Other tarballs may have more Writer's Workbench code but I haven't looked at them.<p>[0] <a href="https://www.tuhs.org/Archive/Distributions/Research/Dan_Cross_v10/v10src.tar.bz2" rel="nofollow">https://www.tuhs.org/Archive/Distributions/Research/Dan_Cros...</a></p>
]]></description><pubDate>Sun, 15 Mar 2020 21:28:30 +0000</pubDate><link>https://news.ycombinator.com/item?id=22586926</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=22586926</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=22586926</guid></item><item><title><![CDATA[New comment by dbremner in "Go compiler internals: Adding a new statement to Go"]]></title><description><![CDATA[
<p>There is a complete list of passes here[0]. It does some optimizations but much less than a mainstream C or C++ compiler.<p>[0] <a href="https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/compile.go#L397" rel="nofollow">https://github.com/golang/go/blob/master/src/cmd/compile/int...</a></p>
]]></description><pubDate>Fri, 05 Jul 2019 20:59:38 +0000</pubDate><link>https://news.ycombinator.com/item?id=20365861</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=20365861</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=20365861</guid></item><item><title><![CDATA[New comment by dbremner in "Ask HN: What are you working on?"]]></title><description><![CDATA[
<p>My side project is a fork[0] of an old Java Swing app. I have been updating the code to use newer Java features and rewriting portions of it in Scala.<p>[0] <a href="https://github.com/dbremner/JavaPH" rel="nofollow">https://github.com/dbremner/JavaPH</a></p>
]]></description><pubDate>Thu, 04 Jul 2019 23:11:50 +0000</pubDate><link>https://news.ycombinator.com/item?id=20358538</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=20358538</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=20358538</guid></item><item><title><![CDATA[Word parallel null byte detection – comp.arch, Alan Mycroft (1987)]]></title><description><![CDATA[
<p>Article URL: <a href="https://groups.google.com/forum/message/raw?msg=comp.arch/2HtQXvg7iKc/xOJeipH6KLMJ">https://groups.google.com/forum/message/raw?msg=comp.arch/2HtQXvg7iKc/xOJeipH6KLMJ</a></p>
<p>Comments URL: <a href="https://news.ycombinator.com/item?id=16093511">https://news.ycombinator.com/item?id=16093511</a></p>
<p>Points: 1</p>
<p># Comments: 0</p>
]]></description><pubDate>Sun, 07 Jan 2018 23:44:59 +0000</pubDate><link>https://groups.google.com/forum/message/raw?msg=comp.arch/2HtQXvg7iKc/xOJeipH6KLMJ</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=16093511</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=16093511</guid></item><item><title><![CDATA[New comment by dbremner in "TerrariaClone – An incomprehensible hellscape of spaghetti code"]]></title><description><![CDATA[
<p>ReSharper (and presumably IntelliJ) supports expression-based search and replace.<p>Here are some commits where I used it to remove boilerplate from some test cases. The code was written long before MSTest added support for Assert.ThrowsException.<p><a href="https://github.com/dbremner/PowerCollections/commit/a364a1548e7ba0e8e57ec63f4cd09aab04c09cda" rel="nofollow">https://github.com/dbremner/PowerCollections/commit/a364a154...</a><p><a href="https://github.com/dbremner/PowerCollections/commit/1de2f916faacea4c62403edb4916363711c5a0e9" rel="nofollow">https://github.com/dbremner/PowerCollections/commit/1de2f916...</a><p><a href="https://github.com/dbremner/PowerCollections/commit/183e3c7c345c667c575a046af348dd6444a24895" rel="nofollow">https://github.com/dbremner/PowerCollections/commit/183e3c7c...</a></p>
]]></description><pubDate>Fri, 13 Oct 2017 03:43:49 +0000</pubDate><link>https://news.ycombinator.com/item?id=15463126</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=15463126</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=15463126</guid></item><item><title><![CDATA[New comment by dbremner in "I Broke Rust's Package Manager for Windows Users"]]></title><description><![CDATA[
<p>Here is a character encoding issue that I ran into about a year ago.<p>git does not support UTF-16LE[0]. The result is that UTF-16LE encoded files will be mangled[1] by the line ending conversion. There is at least one generated Visual Studio file (GlobalSuppressions.cs) that is saved in UTF-16 by default.<p>[0] <a href="https://github.com/libgit2/libgit2/issues/1009" rel="nofollow">https://github.com/libgit2/libgit2/issues/1009</a><p>[1] <a href="https://github.com/Microsoft/Windows-classic-samples/issues/5" rel="nofollow">https://github.com/Microsoft/Windows-classic-samples/issues/...</a></p>
]]></description><pubDate>Mon, 08 May 2017 02:20:09 +0000</pubDate><link>https://news.ycombinator.com/item?id=14288832</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=14288832</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=14288832</guid></item><item><title><![CDATA[New comment by dbremner in "Ask HN: What are you working on?"]]></title><description><![CDATA[
<p>I am writing an interpreter for Gedanken (<a href="https://news.ycombinator.com/item?id=8443298" rel="nofollow">https://news.ycombinator.com/item?id=8443298</a>).</p>
]]></description><pubDate>Wed, 05 Apr 2017 01:19:57 +0000</pubDate><link>https://news.ycombinator.com/item?id=14038872</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=14038872</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=14038872</guid></item><item><title><![CDATA[New comment by dbremner in "What are you working on?"]]></title><description><![CDATA[
<p>I have been hacking on CLR Profiler (<a href="https://clrprofiler.codeplex.com/" rel="nofollow">https://clrprofiler.codeplex.com/</a>) so that it uses less memory, leaks fewer resources, and is faster.</p>
]]></description><pubDate>Sun, 12 Mar 2017 04:39:24 +0000</pubDate><link>https://news.ycombinator.com/item?id=13849004</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=13849004</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=13849004</guid></item><item><title><![CDATA[New comment by dbremner in "What Happens When You Mix Java with a 1960 IBM Mainframe"]]></title><description><![CDATA[
<p>Is <a href="http://maclisp.info/pitmanual/hunks.html" rel="nofollow">http://maclisp.info/pitmanual/hunks.html</a> helpful?</p>
]]></description><pubDate>Tue, 24 Jan 2017 02:34:27 +0000</pubDate><link>https://news.ycombinator.com/item?id=13468356</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=13468356</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=13468356</guid></item><item><title><![CDATA[New comment by dbremner in "Ask HN: Examples of excellent technical writing"]]></title><description><![CDATA[
<p>John R. Ellis' doctoral thesis - Bulldog: A Compiler for VLIW Architectures (<a href="http://www.cs.yale.edu/publications/techreports/tr364.pdf" rel="nofollow">http://www.cs.yale.edu/publications/techreports/tr364.pdf</a>) is an example of excellent technical writing.</p>
]]></description><pubDate>Mon, 28 Nov 2016 03:03:02 +0000</pubDate><link>https://news.ycombinator.com/item?id=13053126</link><dc:creator>dbremner</dc:creator><comments>https://news.ycombinator.com/item?id=13053126</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=13053126</guid></item></channel></rss>