frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

The Little Bool of Doom (2025)

https://blog.svgames.pl/article/the-little-bool-of-doom
42•pocksuppet•2h ago

Comments

djoldman•1h ago
> For this, I used the Godbolt compiler explorer.

> Ah-ha! The generated instructions were ever so slightly different. This would be great news, if it wasn't for me forgetting about one little detail: I have zero knowledge of x86 assembly.

Lol'd at this. I've been there: "ah hah! I found you. hrm, now what does this mean..."

TFA makes me thankful my work doesn't involve C / C++. Learning it earlier in life was enough.

kccqzy•1h ago
Excellent debugging journey.

If I were the author, I would skip the part about using the compiler explorer and reading the assembly. When I write C code, I need to satisfy the rules of the C language. Unless I’m debugging the compiler or dealing with performance issues, my experience is that reading the generated assembler and understanding it is usually a slow way of debugging. The author eventually did compile with -fsanitize=undefined but I would honestly do that first. It prints a nice error message about the exact issue as the author has shown.

direwolf20•1h ago
I have to disagree. If you merely want to fix the problem, you can stop as soon as you find something that's awry and whose alteration removes the problem. But don't you want to understand the problem? Don't you want to see how the compiler can reasonably generate code that says a bool variable is true and false at the same time?
kccqzy•33m ago
It’s about abstraction layers. Most of the time, understanding the generated assembler code isn’t useful when it comes to understanding the problem. It satisfies my curiosity sure, but the problem is at the C level, an undefined behavior.

Understanding what the C compiler generates is interesting, but without a corresponding intuition about the optimizer passes, such understanding is shallow and unlikely to be generalized to other problems in the future. You probably won’t even remember this the next time you debug another undefined behavior. On the other hand, if you were to know the optimizer passes employed by the compiler and could deduce this code from that, then it is a useful exercise to enhance your intuition about them.

Joker_vD•1h ago
> 1. Explicitly set the C standard to C17 or older, so the code is built using the custom boolean type.

> Option 1) seemed like the easiest one, but it also felt a bit like kicking the can down the road – plus, it introduced the question of which standard to use.

Arguably, that's the sanest one: you can't expect the old C code to follow the rules of the new versions of the language. In a better world, each source file would start with something like

    #pragma lang_ver stdc89
and it would automatically kick off the compatibility mode in the newer compilers, but oh well. Even modern languages such as Go miss this obvious solution.

On the topic of the article, yeah, sticking anything other than 0 or 1 into C99 bool type is UB. Use ints.

Tuna-Fish•52m ago
Rust does the right thing, with the per-crate

    edition =
statement.
theamk•58m ago
This brings memories - back when I was a student programming in Turbo Pascal 6, I got the same invalid bool (due to array range overflow) which was both true and false at the same time.
lowbloodsugar•18m ago
That is a fucking travesty. If there’s one thing we should be able to rely on C for it’s that it works with assembly, and it’s always been the case that 0 is false and any other value is true. That’s a compiler bug as far as I’m concerned. I don’t use C++ because it’s gone in a ludicrous unhelpful direction since 2000 or so, but it’s sad to learn that C of all languages decided to favor pedantry over working code.
munchler•11m ago
The code in question is:

    if (sprtemp[frame].rotate == false)
Note that this is explicitly comparing two values, which is very different from checking whether a single value is true. Surely you wouldn't expect -1 == 0 to evaluate to true.
munchler•17m ago
> memset (sprtemp,-1, sizeof(sprtemp));

Yikes. I think this article undersells the point somewhat. This line of code undermines the type system by spraying -1's into an array of structs, so the only surprise to me is that it took this long to break.

Vouch

https://github.com/mitchellh/vouch
299•chwtutha•17h ago•131 comments

I put a real-time 3D shader on the Game Boy Color

https://blog.otterstack.com/posts/202512-gbshader/
163•adunk•3h ago•13 comments

Roundcube Webmail: SVG feImage bypasses image blocking to track email opens

https://nullcathedral.com/posts/2026-02-08-roundcube-svg-feimage-remote-image-bypass/
53•nullcathedral•2h ago•12 comments

The Little Bool of Doom (2025)

https://blog.svgames.pl/article/the-little-bool-of-doom
42•pocksuppet•2h ago•10 comments

Show HN: I created a Mars colony RPG based on Kim Stanley Robinson's Mars books

https://underhillgame.com/
65•ariaalam•3h ago•26 comments

RFC 3092 – Etymology of "Foo" (2001)

https://datatracker.ietf.org/doc/html/rfc3092
97•ipnon•5h ago•18 comments

Running Your Own As: BGP on FreeBSD with FRR, GRE Tunnels, and Policy Routing

https://blog.hofstede.it/running-your-own-as-bgp-on-freebsd-with-frr-gre-tunnels-and-policy-routing/
96•todsacerdoti•6h ago•41 comments

Exploiting signed bootloaders to circumvent UEFI Secure Boot

https://habr.com/en/articles/446238/
60•todsacerdoti•5h ago•30 comments

GitHub Agentic Workflows

https://github.github.io/gh-aw/
137•mooreds•6h ago•73 comments

Omega-3 is inversely related to risk of early-onset dementia

https://pubmed.ncbi.nlm.nih.gov/41506004/
153•brandonb•3h ago•85 comments

Formally Verifying PBS Kids with Lean4

https://www.shadaj.me/writing/cyberchase-lean
45•shadaj•6d ago•2 comments

Bun v1.3.9

https://bun.com/blog/bun-v1.3.9
76•tosh•2h ago•19 comments

Dave Farber has died

https://lists.nanog.org/archives/list/nanog@lists.nanog.org/thread/TSNPJVFH4DKLINIKSMRIIVNHDG5XKJCM/
168•vitplister•8h ago•23 comments

Billing can be bypassed using a combo of subagents with an agent definition

https://github.com/microsoft/vscode/issues/292452
142•napolux•3h ago•72 comments

Curating a Show on My Ineffable Mother, Ursula K. Le Guin

https://hyperallergic.com/curating-a-show-on-my-ineffable-mother-ursula-k-le-guin/
124•bryanrasmussen•10h ago•41 comments

Experts Have World Models. LLMs Have Word Models

https://www.latent.space/p/adversarial-reasoning
14•aaronng91•2h ago•11 comments

Let's compile Quake like it's 1997

https://fabiensanglard.net/compile_like_1997/index.html
78•birdculture•3h ago•23 comments

Show HN: It took 4 years to sell my startup. I wrote a book about it

https://derekyan.com/ma-book/
147•zhyan7109•4d ago•40 comments

Kolakoski Sequence

https://en.wikipedia.org/wiki/Kolakoski_sequence
52•surprisetalk•6d ago•11 comments

OpenClaw is changing my life

https://reorx.com/blog/openclaw-is-changing-my-life/
152•novoreorx•14h ago•256 comments

Why E cores make Apple silicon fast

https://eclecticlight.co/2026/02/08/last-week-on-my-mac-why-e-cores-make-apple-silicon-fast/
188•ingve•8h ago•195 comments

Reverse Engineering Raiders of the Lost Ark for the Atari 2600

https://github.com/joshuanwalker/Raiders2600
76•pacod•11h ago•2 comments

Matchlock – Secures AI agent workloads with a Linux-based sandbox

https://github.com/jingkaihe/matchlock
126•jingkai_he•12h ago•51 comments

A Community-Curated Nancy Drew Collection

https://blog.openlibrary.org/2026/01/30/a-community-curated-nancy-drew-collection/
4•sohkamyung•5d ago•1 comments

Slop Terrifies Me

https://ezhik.jp/ai-slop-terrifies-me/
284•Ezhik•9h ago•254 comments

The First Sodium-Ion Battery EV Is a Winter Range Monster

https://insideevs.com/news/786509/catl-changan-worlds-first-sodium-ion-battery-ev/
87•andrewjneumann•3h ago•81 comments

Show HN: LocalGPT – A local-first AI assistant in Rust with persistent memory

https://github.com/localgpt-app/localgpt
305•yi_wang•19h ago•143 comments

Beyond agentic coding

https://haskellforall.com/2026/02/beyond-agentic-coding
226•RebelPotato•18h ago•84 comments

We mourn our craft

https://nolanlawson.com/2026/02/07/we-mourn-our-craft/
634•ColinWright•1d ago•736 comments

Do Markets Believe in Transformative AI?

https://marginalrevolution.com/marginalrevolution/2025/09/do-markets-believe-in-transformative-ai...
10•surprisetalk•5h ago•1 comments