frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Iterating Backwards in C

https://www.davidpriver.com/Iterating-backwards-in-C.html
25•cremno•3d ago

Comments

abstractspoon•2d ago
I've been using this method for more than 30 years!
MaulingMonkey•59m ago
I prefer:

    const size_t n = 10;
    for (size_t i = n; i --> 0;) {
        std::cout << i << "\n";
    }
ranger_danger•51m ago
Cute but wouldn't work with ssize_t :)

VHDL's array/vector syntax actually works a similar way:

-- gives 0, 1, 2, 3:

for i in 0 to 3 loop

-- gives 3, 2, 1, 0:

for i in 3 downto 0 loop

-- Source - https://stackoverflow.com/a/7642026 -- Posted by Kerrek SB -- Retrieved 2026-10-29, License - CC BY-SA 3.0

fourthark•24m ago
Does work with ssize_t, just not necessary.
hedgehog•50m ago
That's a certain kind of taste... I checked out your home page, game dev, check, and this work of art is worth linking (no irony, I love it):

http://maulingmonkey.com/brainfuck/

kenferry•43m ago
I know it's "too clever", but if I'm writing code no one else will ever see,

  while (i --> 0) {
      // use array[i]
  }
easy to read (if not understand), and correct!
stephencanon•40m ago
Always.

(Hi Ken!)

krackers•35m ago
Oh I remember this from the classic SO post, but it was just presented as a funny trick. I never realized that it solves the issue mentioned in the article and there is a legitimate use-case for post-decrement in the comparison itself.

https://stackoverflow.com/questions/1642028/what-is-the-oper...

viega•27m ago
I always use unsigned values and do:

  while (i-- != 0) { ... }
It's more clear than the most idiomatic way, which is to drop the explicit comparison:

  while (i--) { ... }
 
All of it is better than the clunky old for-loop syntax.

Binance-hacker-1029 – $5.6B stolen from Binance

https://arkm.com/explorer/entity/21a94755-f604-45e5-9501-6542e23005e8
756•Tiberium•4h ago•446 comments

We're releasing the weights of Mistral Large 4

https://mistral.ai/news/mistral-large-4-oss/
1217•kuberwastaken•12h ago•340 comments

We ran AI agent swarms in Minecraft and Mindustry

https://labs.ycombinator.com/projects/games/index.html
167•sandslash•4h ago•62 comments

A tiny world model running games on a Raspberry Pi Pico 2 W

https://github.com/SheepSeb/tinyworldformer
137•airinei•5h ago•8 comments

El Niño Is Flooding California's Coasts with the Highest Tides to Come

https://gizmodo.com/el-nino-is-already-flooding-californias-coasts-and-the-years-highest-tides-ha...
97•gumby•4h ago•30 comments

A Pig, the State, and War: Porco Rosso (Kurenai No Buta) (2014)

https://journal.animationstudies.org/article/id/66/
48•simonebrunozzi•3h ago•8 comments

H.264 Is Magic (2016)

https://sidbala.com/h-264-is-magic/
338•ea016•10h ago•125 comments

Show HN: I Turned DOOM into a Transformer

https://github.com/mottopanikeiku/doomformer
40•falperc•2h ago•9 comments

Iterating Backwards in C

https://www.davidpriver.com/Iterating-backwards-in-C.html
25•cremno•3d ago•9 comments

The Great American Rascal: Tom Sawyer at 150

https://claremontreviewofbooks.com/the-great-american-rascal/
45•beatstop•3h ago•14 comments

Pico CSS is no longer maintained

https://github.com/picocss/pico/discussions/754
4•henrid•15m ago•0 comments

Patrick Stewart has died

https://www.nytimes.com/2026/10/29/arts/television/patrick-stewart-dead.html
2447•j4mie•6h ago•515 comments

LLM Voice

https://martinfowler.com/bliki/LLM-Voice.html
348•ibobev•11h ago•181 comments

Herdr has released native app

https://github.com/herdrdev/herdr-app
14•cherioo•1h ago•6 comments

Study: Schoolwide phone bans show no significant impact on mental health

https://jamanetwork.com/journals/jamanetworkopen/fullarticle/2855858
8•giuliomagnifico•1d ago•2 comments

DoorDash to acquire Instacart

https://about.doordash.com/en-us/news/doordash-to-acquire-instacart
428•WalterSobchak•13h ago•601 comments

Cormac McCarthy's Library

https://cormacmccarthy.lib.utk.edu/
12•maitland•1h ago•2 comments

ElementaryUI – Swift, in the Browser

https://elementary.codes
59•frizlab•5h ago•15 comments

Sylphide OS: a general-purpose OS for microcontroller-based computers

https://projects.freehackers.org/sylphide-os/
39•iamnothere•5h ago•13 comments

Chained PHP2Shell exploit roots 25 servers, including US Government servers

https://dreamgroup.com/blog/chained-php2shell-exploit-roots-25-servers
291•882542F3884314B•15h ago•142 comments

Show HN: Auto Dismiss Mac OS "Allow <app> to find devices on local networks?"

https://github.com/johncassil/dontallow
101•johncassil•6h ago•77 comments

Historical Scientific Instruments

https://nealstephenson.substack.com/p/historical-scientific-instruments
17•peteforde•2d ago•0 comments

If IPv4 were land

https://iptrust.co/blog/if-ipv4-were-land
237•rokostik•13h ago•323 comments

What we know so far about Spain train crash

https://www.bbc.com/news/articles/cm8xz7pkd0jjo
160•ZeljkoS•17h ago•317 comments

Partitioning my digital life into security domains (2011)

https://blog.invisiblethings.org/2011/03/13/partitioning-my-digital-life-into.html
31•mashally•2d ago•0 comments

IgE disruptor for food allergy with Claude-enabled antibody design [pdf]

https://divergencelabs.com/publications/ige-preprint.pdf
38•matco11•6h ago•28 comments

Launch HN: Simantic (YC F26) – Firmware Simulation for AI Agents

51•shong0504•10h ago•14 comments

16colo.rs – ANSI/ASCII art archive

https://16colo.rs/
87•memalign•9h ago•8 comments

Zombie stats: Where the numbers AI quotes come from

https://trakkr.ai/trakkr-research/zombie-stats
145•mektrik•11h ago•63 comments

NetBSD adds a new text editor called atto

https://mastodon.sdf.org/@netbsd/117518160563539748
164•luke8086•14h ago•137 comments