frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Thoughts on Generating C

https://wingolog.org/archives/2026/02/09/six-thoughts-on-generating-c
69•ingve•1h ago

Comments

rirze•45m ago
Love how he put a paragraph for someone asking, "why not generate Rust?". Beautiful.
whizzter•40m ago
Having done this for a dozen of experiments/toys I fully agree with most of the post, would be nice if the the addition of must_tail attribute could be reliable across the big 3 compilers, but it's not something that can be relied on (luckily Clang seems to be fairly reliable on Windows these days).

2 additional points,

1: The article mentions DWARF, even without it you can use #line directives to give line-numbers in your generated code (and this goes a very long way when debugging), the other part is local variables and their contents.

For variables one can get a good distance by using a C++ subset(a subset that doesn't affect compile time, so avoid any std:: namespaced includes) instead and f.ex. "root/gc/smart" ptr's,etc (depending on language semantics), since the variables will show up in a debugger when you have your #line directives (so "sane" name mangling of output variables is needed).

2: The real sore point of C as a backend is GC, the best GC's are intertwined with the regular stack-frame so normal stack-walking routines also gives everything needed for accuracte GC (required for any moving GC designs, even if more naive generation collectors are possible without it).

Now if you want accurate somewhat fast portable stack-scanning the most sane way currently is to maintain a shadow-stack, where you pass prev-frame ptrs in calls and the prev-frame ptr is a ptr to the end of a flat array that is pre-pended by a magic ptr and the previous prev-frame ptr (forming a linked list with the cost of a few writes, one extra argument with no cleanup cost).

Sadly, the performant linked shadow-stack will obfuscate all your pointers for debugging since they need to be clumped into one array instead of multiple named variables (and restricts you from on-stack complex objects).

Hopefully, one can use the new C++ reflection support for shadow-stacks without breaking compile times, but that's another story.

ufo•16m ago
Related to shadow stacks, I've had trouble convincing the C optimizer that no one else is aliasing my heap-allocated helper stacks. Supposedly there ought to be a way to tell it using restrict annotations, but those are quite fiddly: only work for function parameters, and can be dusmissed for many reasons. Does anyone know of a compiler that successfully used restrict pointers in their generated code? I'd love to be pointed towards something that works.
Joker_vD•35m ago
> And finally, source-level debugging is gnarly. You would like to be able to embed DWARF information corresponding to the code you residualize; I don’t know how to do that when generating C.

I think emitting something like

    #line 12 "source.wasm"
for each line of your source before the generated code for that line does something that GDB recognizes well enough.

The Cost of Truth

https://www.samrian.com/blog/cost-of-truth
1•Abdulhafiz_F•1m ago•0 comments

Show HN: Self-hosted WhatsApp archive viewer with chat analytics

https://github.com/sabrieker/whatsapp-archive
1•sabri_eker•2m ago•0 comments

JSONata: A JSON query and transformation language

https://jsonata.org/
1•fanf2•2m ago•0 comments

Vibe coding an RSS feed – how hard can it be?

https://blog.fortrabbit.com/vibe-coding-an-rss-feed/
1•esher•2m ago•0 comments

Writing an LLM from scratch, part 32a – Interventions: training a baseline model

https://www.gilesthomas.com/2026/02/llm-from-scratch-32a-interventions-baseline-model
1•ibobev•4m ago•0 comments

Why Is the Sky Blue?

https://explainers.blog/posts/why-is-the-sky-blue/
2•udit99•4m ago•0 comments

Writing an LLM from scratch, part 32B – Interventions: gradient clipping

https://www.gilesthomas.com/2026/02/llm-from-scratch-32b-interventions-gradient-clipping
1•ibobev•4m ago•0 comments

Child internet safety campaign accused of censoring teenagers' speeches

https://www.theguardian.com/technology/2026/feb/08/childnet-internet-safety-campaign-accused-cens...
1•beardyw•5m ago•0 comments

Writing an LLM from scratch, part 32c – Interventions: removing dropout

https://www.gilesthomas.com/2026/02/llm-from-scratch-32c-interventions-removing-dropout
1•ibobev•5m ago•0 comments

Hello, Dada!

https://smallcultfollowing.com/babysteps/blog/2026/02/09/hello-dada/
2•weinzierl•6m ago•0 comments

Microbial Olympics: Super-duper one-celled athletes

https://knowablemagazine.org/content/article/living-world/2026/welcome-to-the-microbial-olympic-g...
1•PaulHoule•6m ago•0 comments

Trumpedia: Wiki Articles Rewritten by Trump

https://trumpedia.org/
1•nbaronia•8m ago•0 comments

How to Quiet a Ugreen 4800 Plus Without Sacrificing Drive Temps

https://blog.tymscar.com/posts/ugreen4800plusquiet/
1•tymscar•8m ago•0 comments

OpenClaw: I gave an AI my credit card and let it loose on Amazon

https://www.codedojo.com/?p=3243
1•surrTurr•8m ago•0 comments

Taiwan rejects possibility of transferring 40% of semiconductor capacity to US

https://www.tomshardware.com/tech-industry/semiconductors/taiwan-rejects-possibility-of-transferr...
1•pseudolus•9m ago•0 comments

Identification of Chlamydia pneumoniae in Alzheimer's disease retina

https://www.nature.com/articles/s41467-026-68580-4
1•bookofjoe•9m ago•0 comments

Tarot: XVII the Star: Quantum Computing

https://www.suzannetreister.net/HEXEN2/TAROT_COL/TAROT_Star-Quantum.html
1•isomorph•9m ago•0 comments

The Crank Spectrum

https://exple.tive.org/blarg/2026/02/07/on-the-crank-spectrum/
1•speckx•11m ago•0 comments

Show HN: ChatKeepsake – Turn iMessage Conversations into Printable Keepsakes

https://chatkeepsake.com/
1•ryan_gaudet•11m ago•0 comments

Hexen 2.0

https://www.suzannetreister.net/HEXEN2/TAROT_COL/HEXEN_2_TAROT.html
1•isomorph•12m ago•0 comments

The AGAT (Adventure Game Aptitude Test)

https://theagat.co/
1•JohnHendrix•12m ago•1 comments

Show HN: Open source setup to self-host OpenClaw instances on any host

https://github.com/Agent-3-7/openclaw-host-kit
5•vishnukool•13m ago•5 comments

Ask HN: What is this "boilerplate" of which you speak?

3•qwesfaqsfg•13m ago•1 comments

Sandboxels

https://neal.fun/sandboxels/
1•2sf5•13m ago•0 comments

Plausible – Find the definition of an obscure word among fake definitions

https://plausiblegame.com/en
1•alexdobrenko•15m ago•0 comments

How Does Truffle Taste? Strategic Lessons for Introducing Agentic Engineering

https://www.robert-glaser.de/the-elastic-loop-introducing-agentic-engineering-strategically/
1•youngbrioche•16m ago•0 comments

Show HN: AI Seedance 2 – Solving the "jump-cut" problem in AI video

https://www.aiseedance2.app
1•TurnItOffAndOn0•16m ago•0 comments

Twenty Five Percent Without Thinking

https://fakepixels.substack.com/p/twenty-five-percent-without-thinking
1•dmonay•17m ago•0 comments

New compliance page – open-source

https://compliance.getprobo.com/overview
1•ArthurMx•17m ago•0 comments

Show HN: Verify Your Kubernetes

https://github.com/avkcode/verifier
1•KyleVlaros•17m ago•0 comments