<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: clausecker</title><link>https://news.ycombinator.com/user?id=clausecker</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Tue, 29 Sep 2026 06:33:33 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=clausecker" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by clausecker in "C's Flexible Integer Sizes Were Not a Design Mistake"]]></title><description><![CDATA[
<p>The key problem with C's type sizes is that ANSI C had no way to get fixed integer types, so if the basic types char, short, int, and long didn't have the size you wanted, it might as well not have existed.<p>For this reason, platform designers were motivated to provide some 32 bit type, which by elimination needs to be int (it can't be char, which must be 8 bits, it can't be short or else you have no 16 bit type, so it must be int or long, but a 16 bit int is silly).  Initial 64 bit ABIs were defined with 64 bit int types (ILP64 platforms, such as the first SPARC64 Solaris port) and the problems quickly became apparent when random C software packages failed to configure, compile, or work.  Switching to LP64/LLP64 (where int is 32 bits and long is 32 resp. 64 bits) fixed this, at the cost of having to reeducate programmers to use size_t for array indexing.  The decision between LP64 and LLP64 was then probably motivated by time_t, which traditionally is a long.  If you do LLP64, long and thus time_t is 32 bits and you'll fall prey to the year 2036 problem.  Or you use long long for time_t, breaking compatibility with ANSI C and a lot of old software.  Most UNIX platforms decided to use LP64 thus, while non-UNIX platforms without this issue frequently went with LLP64 instead, reaping the benefit of staying compatible with software that assumes long is 32 bits.<p>These days, you probably need only three platform-dependently-sized types (as Go does):<p>- int/uint for array indexing; native word size, signed and unsigned
 - uintptr for round-tripping data pointers<p>uintptr needs to be different as there are a few platforms where pointers are larger than indices, for example:<p>- on 8086 and i286, pointers are 32 bits (segment+offset) in some code models, while indices are only 16 bits
 - on IBM iSeries, pointers are 128 bits, while indices are 32 or 64 bits
 - on capability architectures like CHERI, capabilities (pointers) are 128 bits and need special treatment, while integers are 32 or 64 bits
 - on MSP430X, pointers are 20 bits (!) while integers are 16 bits<p>Conceivably one might also need a separate type for text pointers, as these are some times of different size than data pointers (e.g. on PIC), but as arithmetic on text pointers does not generally make sense, a corresponding integer type can perhaps be omitted (use a generic function type).  This also helps with platforms like PowerPC, where text pointers are pairs of addresses (entry+toc).<p>C's ptrdiff_t can be omitted if you follow C semantics, where differences between pointers are only meaningful within the same object, as that's just int.  intptr_t does not really make a lot of sense, pointers are unsigned except on weirdo platforms (such as balanced ternary machines).<p>C's maxalign_t and (u)intmax_t are problematic, as they fail when the architecture is expanded with new features.  For example, maxalign_t might have an 8 byte alignment on x86, but then you add SSE which requires a 16 byte alignment, AVX with a 32 byte alignment, AVX-512 with a 64 byte alignment and so on.  Not good news.  Same for (u)intmax_t, which end up stopping you from ever supporting larger integer types.  It is not entirely clear what the solution is.  For maxalign_t, perhaps the maximum alignment can be queried at runtime.  For (u)intmax_t, perhaps use generic programming to instantiate the relevant code paths for the actual type used.</p>
]]></description><pubDate>Mon, 28 Sep 2026 12:14:30 +0000</pubDate><link>https://news.ycombinator.com/item?id=49876801</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=49876801</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=49876801</guid></item><item><title><![CDATA[New comment by clausecker in "C's Flexible Integer Sizes Were Not a Design Mistake"]]></title><description><![CDATA[
<p>The main reason they did it like that is that a lot of software expects 8, 16, and 32 bits to be found among the basic types and if it did not find all the types, things would go wrong horribly.  It's quite unfortunate.</p>
]]></description><pubDate>Mon, 28 Sep 2026 11:29:08 +0000</pubDate><link>https://news.ycombinator.com/item?id=49876400</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=49876400</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=49876400</guid></item><item><title><![CDATA[New comment by clausecker in "Just Use Go"]]></title><description><![CDATA[
<p>Go had panic/recover right from the get go.  Nobody “caved.”  And indeed, you are free to use panic/recover for error handling in your code.  That was always allowed.<p>That said, the key insight of the exception craze is that error returns are a normal part of a functions behaviour and as such should not use extraordinary control flow to take place.<p>Exceptions (panics) are used for things that should never happen or are indicative of a programmer error, like nil dereferences or out-of-bounds array accesses.  That is, things where the programmer is not expected to provide reasonable behaviour on the API level if it happens (but perhaps there is a whole-program fault handler to shut down cleanly).<p>Opening a file that does not exist?  Database record not found?  Invalid credentials?  These should be anticipated by the programmer and can occur at any time.  Not exceptions, normal return values.  Go requests that you think about these possibilities instead of pretending they can be ignored.</p>
]]></description><pubDate>Sun, 10 May 2026 09:53:41 +0000</pubDate><link>https://news.ycombinator.com/item?id=48082468</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=48082468</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48082468</guid></item><item><title><![CDATA[New comment by clausecker in "Just Use Go"]]></title><description><![CDATA[
<p>Really bad idea.<p>Silently returning some (the wrong) value is always worse than catching the error right then and their and panicking.  A panic is a noticeable symptom of something just having go wrong that is easy to chase after and debug.  A silently returned wrong value just causes data corruption down the line, at great pain.  It is very annoying to debug, in particular if people start to some times rely on this behaviour as an intentional part of their data flow.</p>
]]></description><pubDate>Sun, 10 May 2026 09:44:20 +0000</pubDate><link>https://news.ycombinator.com/item?id=48082420</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=48082420</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48082420</guid></item><item><title><![CDATA[New comment by clausecker in "Just Use Go"]]></title><description><![CDATA[
<p>> No it really doesn't. It litters your code with if statements that are all just about the same, except that one that needs to be different, and you go blind looking at them all and can't spot the difference.<p>If most of your error handling is just bubbling the error up, you are doing something wrong.<p><pre><code>  if err != nil { return err; }
</code></pre>
is an antipattern.  Not because it's verbose, but because you are supposed to handle the error, not pass it right through, in most cases.</p>
]]></description><pubDate>Sun, 10 May 2026 09:36:43 +0000</pubDate><link>https://news.ycombinator.com/item?id=48082381</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=48082381</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48082381</guid></item><item><title><![CDATA[New comment by clausecker in "A SIMD coding challenge: First non-space character after newline"]]></title><description><![CDATA[
<p>You can find the first set bit in an integer with a machine instruction, it's completely branch free.  gcc has __builtin_ctz() for this.  You'll either need to iterate over all set bits (so one branch per set bit) or use a compression instruction (requiring AVX-512) to turn the bit set into a set of integers.<p>That said, as you seem to actually want to do something with the results, you'll take a branch per match anyway, so I don't see the problem.</p>
]]></description><pubDate>Tue, 30 Dec 2025 01:48:22 +0000</pubDate><link>https://news.ycombinator.com/item?id=46428553</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46428553</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46428553</guid></item><item><title><![CDATA[Hacking Washing Machines [video]]]></title><description><![CDATA[
<p>Article URL: <a href="https://media.ccc.de/v/39c3-hacking-washing-machines">https://media.ccc.de/v/39c3-hacking-washing-machines</a></p>
<p>Comments URL: <a href="https://news.ycombinator.com/item?id=46428496">https://news.ycombinator.com/item?id=46428496</a></p>
<p>Points: 222</p>
<p># Comments: 49</p>
]]></description><pubDate>Tue, 30 Dec 2025 01:40:49 +0000</pubDate><link>https://media.ccc.de/v/39c3-hacking-washing-machines</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46428496</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46428496</guid></item><item><title><![CDATA[New comment by clausecker in "A SIMD coding challenge: First non-space character after newline"]]></title><description><![CDATA[
<p>So I've thought about it and I don't really feel like spending more time to convince you that this works.  If you have questions I am happy to answer them, but please write your own code.</p>
]]></description><pubDate>Sun, 28 Dec 2025 18:24:51 +0000</pubDate><link>https://news.ycombinator.com/item?id=46413236</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46413236</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46413236</guid></item><item><title><![CDATA[New comment by clausecker in "A SIMD coding challenge: First non-space character after newline"]]></title><description><![CDATA[
<p>This does track the state.  If you want to track it across multple vectors of input, you'll need to carry it over manually.</p>
]]></description><pubDate>Sun, 28 Dec 2025 18:23:28 +0000</pubDate><link>https://news.ycombinator.com/item?id=46413228</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46413228</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46413228</guid></item><item><title><![CDATA[New comment by clausecker in "A SIMD coding challenge: First non-space character after newline"]]></title><description><![CDATA[
<p>You can do it like this, assuming A is the mask of newlines and B is the mask of non-spaces.<p>1. Compute M1 = ~A & ~B, which is the mask of all spaces that are not newlines
2. Compute M2 = M1 + (A << 1) + 1, which is the first non-space or newline after each newline and then additional bits behind each such newline.
3. Compute M3 = M2 & ~M1, which removes the junk bits, leaving only the first match in each section<p>Here is what it looks like:<p><pre><code>    10010000 = A
    01100110 = B
    00001001 = M1 = ~A & ~B
    00101010 = M2 = M1 + (A << 1) + 1
    00100010 = M3 = M2 & ~M1
</code></pre>
Note that this code treats newlines as non-spaces, meaning if a line comprises only spaces, the terminating NL character is returned. You can have it treat newlines as spaces (meaning a line of all spaces is not a match) by computing M4 = M3 & ~A.</p>
]]></description><pubDate>Fri, 26 Dec 2025 00:24:55 +0000</pubDate><link>https://news.ycombinator.com/item?id=46388013</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46388013</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46388013</guid></item><item><title><![CDATA[New comment by clausecker in "Package managers keep using Git as a database, it never works out"]]></title><description><![CDATA[
<p>We do this with FreeBSD ports, but users don't have to clone the ports tree unless they want to modify ports or compile them with custom options.</p>
]]></description><pubDate>Fri, 26 Dec 2025 00:01:53 +0000</pubDate><link>https://news.ycombinator.com/item?id=46387896</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46387896</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46387896</guid></item><item><title><![CDATA[New comment by clausecker in "Uninitialized garbage on ia64 can be deadly (2004)"]]></title><description><![CDATA[
<p>And the same reason NVRAM was dead on arrival.  No affordable dev systems meant that only enterprise software supported it.</p>
]]></description><pubDate>Mon, 08 Dec 2025 13:50:44 +0000</pubDate><link>https://news.ycombinator.com/item?id=46192202</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46192202</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46192202</guid></item><item><title><![CDATA[New comment by clausecker in "Addressing the adding situation"]]></title><description><![CDATA[
<p>That's more "load store architecture" than RISC.  And by that measure, S/360 could be considered a RISC.</p>
]]></description><pubDate>Wed, 03 Dec 2025 12:40:11 +0000</pubDate><link>https://news.ycombinator.com/item?id=46133815</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46133815</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46133815</guid></item><item><title><![CDATA[New comment by clausecker in "Addressing the adding situation"]]></title><description><![CDATA[
<p>You may enjoy the RISC deprogrammer: <a href="https://blog.erratasec.com/2022/10/the-risc-deprogrammer.html" rel="nofollow">https://blog.erratasec.com/2022/10/the-risc-deprogrammer.htm...</a></p>
]]></description><pubDate>Wed, 03 Dec 2025 12:38:58 +0000</pubDate><link>https://news.ycombinator.com/item?id=46133809</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46133809</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46133809</guid></item><item><title><![CDATA[New comment by clausecker in "Poll HN: What operating system do you primarily develop on?"]]></title><description><![CDATA[
<p>FreeBSD</p>
]]></description><pubDate>Fri, 28 Nov 2025 18:16:16 +0000</pubDate><link>https://news.ycombinator.com/item?id=46081194</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46081194</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46081194</guid></item><item><title><![CDATA[New comment by clausecker in "FEX-emu – Run x86 applications on ARM64 Linux devices"]]></title><description><![CDATA[
<p>ARM already has most stuff required for this on board.  Two proprietary extensions are used by Rosetta: one emulates the parity (rarely used) and half-carry (obsolete) flags, which can also be emulated conventionally.  The other implementa TSO memory ordering, which can either be ignored or implemented with explicit barriers; some other chips apparently have a similar setting.<p>The other stuff is all present in ARMv8.5 I think.</p>
]]></description><pubDate>Fri, 21 Nov 2025 19:35:29 +0000</pubDate><link>https://news.ycombinator.com/item?id=46008062</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=46008062</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=46008062</guid></item><item><title><![CDATA[New comment by clausecker in "Fortran Outsmarted Our Billion-Dollar AI Chips"]]></title><description><![CDATA[
<p>It's very likely that there is some serious autovectorisation going on behind the scenes.</p>
]]></description><pubDate>Mon, 10 Nov 2025 22:16:37 +0000</pubDate><link>https://news.ycombinator.com/item?id=45881684</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=45881684</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=45881684</guid></item><item><title><![CDATA[New comment by clausecker in "End of Japanese community"]]></title><description><![CDATA[
<p>Best one was when gedit had the option to syntax highlight for a language named “Los.”</p>
]]></description><pubDate>Thu, 06 Nov 2025 11:46:54 +0000</pubDate><link>https://news.ycombinator.com/item?id=45834171</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=45834171</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=45834171</guid></item><item><title><![CDATA[New comment by clausecker in "Why every Rust crate feels like a research paper on abstraction"]]></title><description><![CDATA[
<p>Had the same feeling browsing through the Haskell package collection.  Felt like and almagamation of PhD theses, none of which were maintained after the author got his degree.  Every single one a work of art, but most engeneered so badly that you would only use them begrudgingly.</p>
]]></description><pubDate>Sun, 19 Oct 2025 22:40:03 +0000</pubDate><link>https://news.ycombinator.com/item?id=45638676</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=45638676</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=45638676</guid></item><item><title><![CDATA[New comment by clausecker in "Mysterious Intrigue Around an x86 "Corporate Entity Other Than Intel/AMD""]]></title><description><![CDATA[
<p>Such as?</p>
]]></description><pubDate>Fri, 17 Oct 2025 00:26:39 +0000</pubDate><link>https://news.ycombinator.com/item?id=45612218</link><dc:creator>clausecker</dc:creator><comments>https://news.ycombinator.com/item?id=45612218</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=45612218</guid></item></channel></rss>