frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

The C ``Clockwise/Spiral Rule''

https://c-faq.com/decl/spiral.anderson.html
14•etrvic•3h ago

Comments

stephencanon•39m ago
This comes up every so often, and while it's sort of almost true and attractive, it isn't actually correct.

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": https://cseweb.ucsd.edu/~gbournou/CSE131/rt_lt.rule.html).

mananaysiempre•25m ago
Why would you do that? Ignoring for the moment arguments of prototypes and sizes of arrays, read C declarations the way they were designed: “char *a[<whatever>]” means that the expression *a[<whatever>] has type char; “char (*a(<whatever>))[<whatever>]” means that the expression (*a(<whatever>))[<whatever>] has type char; and so on. Then you apply the normal precedence rules for expressions, and in this case only knowing them for the prefix and postfix operators is sufficient. (Hint: all prefix operators have one precedence and all postfix ones another, and you know which one binds tighter if you know what *i++ means.)
jcranmer•25m ago
The best summary--and easiest to remember, IMHO--is that variables are declared as they are used.

Want to write an array of function pointers that return a pointer to an array of pointers to int? Well, that's:

  array ... -> x[N]
  ... of function pointers ... -> T (*x[N])()
  ... that return a pointer ... -> T *(*x[N])()
  ... to an array ... -> T (*(*x[N])())[M]
  ... of pointers ... -> T *(*(*x[N])())[M]
  ... to int ... -> int *(*(*x[N])())[M]
It doesn't make it all that easy to read, but you can at least write the complex types pretty reliably.

(The real answer is of course to just typedef every function pointer type or pointer-to-array and not worry about it anymore.)

Joker_vD•37m ago
> "str is an array 10 of pointers to char"

Wow, imagine if it was possible to actually use a language like that do declare the type of the variable like that? Something like

    str: array [0..9] of ^Char; 
or even

    var str [10]*uint8
Just imagine...
pcfwik•33m ago
Being taught this rule in undergrad really hampered my appreciation of C. As I've said in a previous comment, the real key that unlocked understanding C declarations for me is the mantra "declaration follows use." 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. Once I understood this elegant idea, it became hard to enjoy using statically typed languages that eschew it.

It is explained in more detail at this link: https://eigenstate.org/notes/c-decl

AlienRobot•32m ago
This is why I like python.

str is a duck.

classified•30m ago
This is useful if you're far from the internet. Here's a web site that translates the gibberish to English or vice versa:

https://cdecl.org/

Or

  apt install cdecl
on Linux.

Elevators

https://john.fun/elevators
238•Jrh0203•1h ago•88 comments

Big Food vs. the People

https://www.lighthousereports.com/investigation/big-food-vs-the-people/
33•jruohonen•57m ago•3 comments

DeepSeek V4 Flash 0731 Intelligence, Performance and Price Analysis

https://artificialanalysis.ai/models/deepseek-v4-flash
384•theanonymousone•9h ago•208 comments

DeepSeek-V4-Flash Update

https://api-docs.deepseek.com/updates/
533•dnhkng•10h ago•257 comments

Algorithms on billion-scale graph using 10GB RAM: I love DataFusion

https://semyonsinchenko.github.io/ssinchenko/post/datafusion-graphs-cc-2/
19•speckx•1h ago•3 comments

Miso (YC S16) is hiring for U.S. expansion

https://www.ycombinator.com/companies/miso/jobs/g2uAlMG-founding-business-lead-u-s-expansion
1•victorology•54s ago

Arch Linux disables AUR package adoption

https://lwn.net/Articles/1086489/
39•database64128•3h ago•8 comments

I built a f.lux alternative because the M5 Max firmware broke existing solutions

https://driftformac.app/
22•jackvanstone•1h ago•13 comments

A GTK4 SSH-askpass in Zig

https://xn--gckvb8fzb.com/a-gtk4-ssh-askpass-in-zig/
23•surprisetalk•1h ago•6 comments

The End of an Era

https://hughhowey.com/the-end-of-an-era/
281•harscoat•5h ago•320 comments

Make Everything to Markdown

https://klartext.it-handwerk-stuttgart.de/
20•Beko2210•1h ago•5 comments

13 Models and 4 Agents on SWE Tasks: Go, Java, Python, Rust, TS

https://swe-rebench.com
10•ibragim_bad•1h ago•3 comments

The session you cannot take with you

https://earendil.com/posts/session-portability/
667•apitman•13h ago•189 comments

Google fixed more Chrome bugs in June than over the past two years, thanks to AI

https://blog.google/security/chrome-stronger-with-every-update/
397•Garbage•9h ago•384 comments

The C ``Clockwise/Spiral Rule''

https://c-faq.com/decl/spiral.anderson.html
16•etrvic•3h ago•7 comments

Show HN: BitBang – Reach machines behind NAT from a browser, no account

https://github.com/richlegrand/bitbang-cli
11•narragansett•2h ago•1 comments

Is AI reasoning right for the wrong reasons?

https://www.quantamagazine.org/is-ai-reasoning-right-for-the-wrong-reasons-20260731/
65•retupmoc01•1h ago•66 comments

New Defcon Badges Pack a Unique Open-Source Chip That Doubles as a Security Key

https://www.wired.com/story/defcon-34-badge-baochip-andrew-bunnie-huang/
36•hn_acker•1h ago•7 comments

IMAX vs. IMAX 70mm: The difference between these two cinema formats

https://www.engadget.com/2220571/differences-between-imax-70mm/
46•ksec•6d ago•62 comments

Show HN: I built a cross-browser extension that controls fingerprinting surfaces

https://privacything.com/en/
12•tomaszjanusz•2h ago•2 comments

Anti-fraud tools can't keep pace with scammers exploiting cheap internet calling

https://broadbandbreakfast.com/how-to-fight-back-against-fraudulent-robocalls/
17•dredmorbius•3h ago•9 comments

Danube's record low levels force shutdown of Hungary's only nuclear plant

https://www.bbc.com/news/articles/cn0nqv05g0do
64•vrganj•9h ago•86 comments

The Maxwell Conjecture Is False (GPT 5.6 Sol)

https://arxiv.org/abs/2607.27197
105•rahen•5h ago•95 comments

The Art of Decision-Making (2019)

https://www.newyorker.com/magazine/2019/01/21/the-art-of-decision-making
8•EndXA•1h ago•0 comments

Situational Awareness down 67% in July in AI stock rout

https://www.wsj.com/finance/investing/situational-awareness-down-67-in-july-in-ai-stock-rout-cd19...
106•pondsider•3h ago•105 comments

Winding Down Artichoke Ruby

https://hyperbo.la/w/winding-down-artichoke-ruby/
41•ksec•5d ago•4 comments

Moonshot’s Kimi uses 20k Nvidia chip cluster from Alibaba

https://www.bloomberg.com/news/articles/2026-07-31/moonshot-s-kimi-built-on-20-000-nvidia-chip-cl...
65•gk1•3h ago•42 comments

The most official water costs $120k a gallon

https://signoregalilei.com/2026/07/26/the-most-official-water-costs-120000-a-gallon/
19•surprisetalk•2h ago•2 comments

Dubious research tied to Red Bull has shaped energy drink policy

https://www.theexamination.org/articles/red-bull-funded-research-energy-drinks-alcohol
50•Jimmc414•1h ago•76 comments

Show HN: Gander, an Android file viewer that asks for no permissions at all

https://github.com/mokshablr/gander
173•mokshablr•11h ago•62 comments