frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Cdecl-dump - represent C declarations visually

https://github.com/bbu/cdecl-dump
12•bluetomcat•3h ago
A small tool that parses C declarations and outputs a simple visual representation at each stage, as it encounters arrays, pointers or functions.

The program uses a table-driven lexer and a hand-written, shift-reduce parser. No external dependencies apart from the standard library.

Comments

coherentpony•2h ago
I don’t understand what the visualisation screenshot in the README is trying to communicate to me.
bluetomcat•1h ago
It starts from the identifier. At every stage, it outputs a sub-expression which is the “mirrored use” and corresponds to the boxed representation below it. When it reaches the top of the expression, it prints the final type of the expression which is the lone specifier-qualifier list.

As per the screenshot, “arr” is an array of 4 elements. Consequently, “arr[0]” is an array of 8 elements. Then, “arr[0][0]” is a pointer. And so on, until we arrive at the specifier-qualifier list.

pcfwik•2h ago
Since this is about C declarations: for anyone who (like me) had the misfortune of learning the so-called "spiral rule" in college rather than being taught how declarations in C work, below are some links that explain the "declaration follows use" idea that (AFAIK) is the true philosophy behind C declaration syntax (and significantly easier to remember/read/write).

TL;DR: you declare a variable in C _in exactly the same way you would use it:_ if you know how to use a variable, then you know how to read and write a declaration for it.

https://eigenstate.org/notes/c-decl https://news.ycombinator.com/item?id=12775966

nitrix•10m ago
That is correct.

  int x, *p, arr[5], fn(), (*pfn)();
Using x, or dereferencing p, or subscripting the array arr, or declaring a function that can be called with fn, or dereferencing the function pointer pfn then calling it, all these things would produce an int.

It's the intended way to read/write declarations/expressions. As a consequence, asterisks ends up placed near the identifiers. The confused ones will think it's a stylistic choice and won't understand any of this.

saagarjha•3m ago
Of course, the correct way to use a function pointer is to call it.
nitrix•2m ago
Yes, the () operator dereference function pointers automatically for you for convenience. There's also the surprise that you can infinitely dereference function pointers as they just yield you more function pointers.

I failed to recreate the 1996 Space Jam website with Claude

https://j0nah.com/i-failed-to-recreate-the-1996-space-jam-website-with-claude/
358•thecr0w•11h ago•287 comments

Bag of words, have mercy on us

https://www.experimental-history.com/p/bag-of-words-have-mercy-on-us
84•ntnbr•5h ago•75 comments

Mechanical power generation using Earth's ambient radiation

https://www.science.org/doi/10.1126/sciadv.adw6833
75•defrost•6h ago•26 comments

Dollar-stores overcharge customers while promising low prices

https://www.theguardian.com/us-news/2025/dec/03/customers-pay-more-rising-dollar-store-costs
301•bookofjoe•13h ago•458 comments

The C++ standard for the F-35 Fighter Jet [video]

https://www.youtube.com/watch?v=Gv4sDL9Ljww
213•AareyBaba•10h ago•208 comments

Google Titans architecture, helping AI have long-term memory

https://research.google/blog/titans-miras-helping-ai-have-long-term-memory/
425•Alifatisk•15h ago•143 comments

Uninitialized garbage on ia64 can be deadly (2004)

https://devblogs.microsoft.com/oldnewthing/20040119-00/?p=41003
43•HeliumHydride•3d ago•15 comments

The era of jobs is ending

https://www.thepavement.xyz/p/the-era-of-jobs-is-ending
29•SturgeonsLaw•3h ago•19 comments

Work disincentives hit the near-poor hardest (2022)

https://www.niskanencenter.org/work-disincentives-hit-the-near-poor-hardest-why-and-what-to-do-ab...
46•folump•5d ago•19 comments

Turtletoy

https://turtletoy.net/
18•ustad•4d ago•1 comments

An Interactive Guide to the Fourier Transform

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/
165•pykello•5d ago•20 comments

What the heck is going on at Apple?

https://www.cnn.com/2025/12/06/tech/apple-tim-cook-leadership-changes
89•methuselah_in•11h ago•101 comments

Vibe Coding: Empowering and Imprisoning

https://www.anildash.com/2025/12/02/vibe-coding-empowering-and-imprisoning/
31•zdw•5d ago•19 comments

Scala 3 slowed us down?

https://kmaliszewski9.github.io/scala/2025/12/07/scala3-slowdown.html
195•kmaliszewski•13h ago•121 comments

Socialist ends by market means: A history

https://lucasvance.github.io/2100/history/
33•sirponm•1h ago•6 comments

Toyota Unintended Acceleration and the Big Bowl of "Spaghetti" Code (2013)

https://www.safetyresearch.net/toyota-unintended-acceleration-and-the-big-bowl-of-spaghetti-code/
19•SoKamil•3h ago•14 comments

How I block all online ads

https://troubled.engineer/posts/no-ads/
109•StrLght•6h ago•87 comments

The Anatomy of a macOS App

https://eclecticlight.co/2025/12/04/the-anatomy-of-a-macos-app/
202•elashri•15h ago•59 comments

Impacts of working from home on mental health tracked in study of 16K Aussies

https://www.abc.net.au/news/2025-12-05/australian-working-from-home-mental-health-impacts-tracked...
10•anotherevan•3d ago•6 comments

CATL expects oceanic electric ships in 3 years

https://cleantechnica.com/2025/12/05/catl-expects-oceanic-electric-ships-in-3-years/
83•thelastgallon•1d ago•72 comments

Build a DIY magnetometer with a couple of seasoning bottles

https://spectrum.ieee.org/listen-to-protons-diy-magnetometer
74•nullbyte808•1w ago•17 comments

Show HN: Cdecl-dump - represent C declarations visually

https://github.com/bbu/cdecl-dump
12•bluetomcat•3h ago•6 comments

Millions of Americans mess up their taxes, but a new law will help

https://www.wakeuptopolitics.com/p/millions-of-americans-mess-up-their
52•toomuchtodo•9h ago•33 comments

Spinlocks vs. Mutexes: When to Spin and When to Sleep

https://howtech.substack.com/p/spinlocks-vs-mutexes-when-to-spin
47•birdculture•3h ago•10 comments

A two-person method to simulate die rolls (2023)

https://blog.42yeah.is/algorithm/2023/08/05/two-person-die.html
55•Fraterkes•2d ago•34 comments

Nested Learning: A new ML paradigm for continual learning

https://research.google/blog/introducing-nested-learning-a-new-ml-paradigm-for-continual-learning/
92•themgt•13h ago•2 comments

I wasted years of my life in crypto

https://twitter.com/kenchangh/status/1994854381267947640
76•Anon84•15h ago•113 comments

Estimates are difficult for developers and product owners

https://thorsell.io/2025/12/07/estimates.html
170•todsacerdoti•9h ago•182 comments

The state of Schleswig-Holstein is consistently relying on open source

https://www.heise.de/en/news/Goodbye-Microsoft-Schleswig-Holstein-relies-on-Open-Source-and-saves...
524•doener•15h ago•238 comments

Java Hello World, LLVM Edition

https://www.javaadvent.com/2025/12/java-hello-world-llvm-edition.html
168•ingve•16h ago•60 comments