HN Hall of Fame Weekly email

The Clockwise/Spiral Rule of C declarations

c-faq.com Books & learning Tutorials & guides Software engineering Candidate
Screenshot of c-faq.com captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 11 calendar years, with breakout response in 3 of them.

submissions
13
submitters
11
observed span
2010–2025
peak thread · 75 comments
225 pts
latest 20+ return · 2025-01-01
39 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

This has been posted before[1], and the "spiral rule" is a load of hooey. The correct rule is "follow the C grammar". An easier to remember and also correct rule is "start at the identifier being declared; work outwards from that point, reading right until you hit a closing parenthesis, then left until you hit the corresponding open parenthesis, then resume reading right..." (this is sometimes called the "right-left rule"[2]). The "spiral rule" dances around the truth without actually being…

I've always had a bit more luck with the "typedef each step of the construction" rule-of-thumb. Also, I tend to hide anything as complex as "pointer-to-array-of-pointers-to-functions" (even though you memorize this idiom pretty quickly after an hour in the kernel) behind library ADT's, so you're never indexing an array, but rather passing an index and a whatever_t* to whatever_get(w, index).

tptacek·132-point thread·

I link to my old response every time the "spiral rule" comes up. It makes for pretty pictures, but it's nonsense. https://news.ycombinator.com/item?id=5080096

The spiral rule works only if there is no pointer to pointer or array of array in the type. In other words it is an incorrect rule. But take this for example: +----------------------------+ | +-----------------------+ | | | +------------------+ | | | | | +-------------+ | | | | | | | +--------+ | | | | | | | | | +--+ | | | | | | | | | | ^ | | | | | |…

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
3

100+ points or 50+ comments

Total points
505

reference only — not used in Hall rules or ranking

Total comments
233

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2010-06-26No more confusions on tricky C declarationsFirst breakoutashishb4u13241
2012-11-06The "Clockwise/Spiral Rule" (a C tip)geoka930
2013-09-30The Clockwise/Spiral Rulepravnar87
2014-02-12The 'Clockwise/Spiral Rule', How to read C declarations.sjarvie10
2014-11-23The “Clockwise/Spiral Rule”dsr126426
2016-10-23The Clockwise/Spiral Rule of C declarationsBest threadxvirk22568
2019-09-16Clockwise/Spiral Rule (1994)Tomte20
2020-03-25Clockwise/Spiral Rule (1994)Tomte20
2020-12-21Clockwise/Spiral Ruleasamant2516
2022-10-03Clockwise/Spiral Rulemax23_10
2023-01-10Clockwise/Spiral Rule (1994)Tomte10
2024-12-01The "Clockwise/Spiral Rule" (1994)andrelaszlo20
2025-01-01C "clockwise/spiral" rule to understand declarationsLatest 20+ point returngalkk3975