HN Hall of Fame Weekly email

The Lost Art of C Structure Packing

Screenshot of www.catb.org captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 8 calendar years, with breakout response in 5 of them.

submissions
17
submitters
15
observed span
2014–2026
peak thread · 153 comments
335 pts
latest 20+ return · 2022-04-27
159 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

I do optimal structure (and bit) packing without much thought because it is an old habit. As the article states, I have noticed that the only other people that do habitual careful structure optimization these days have been doing low-level and high-performance code as long as I have. Most programmers are oblivious to it. The reasons you would do it today are different than a decade ago and the rules have changed because the processors have changed. To add two…

Awareness of the layout and size of data is still very common in game development. Mike Acton did a great talk related to this at CppCon a few years ago : https://www.youtube.com/watch?v=rX0ItVEVjHc

TL;DR: to get smaller structures, don't do stuff like this: struct foo { char a; int b; char c; int d; }; but this: struct foo { int b; // or int b, c; int c; char a; char c; }; Basically if you sort the types by size in reverse descending order, you get optimal packing without messing with compiler-specific packing extensions that skew alignment and possibly bloat code. The worst that you will get is padding at the…

If you do any development that requires touching Win32, structure packing and memory alignment is still very real. I was recently doing that in the context of improving a language’s library support for something that had to go through the OS SDK. I don’t miss the days when that stuff was the norm.

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
5

100+ points or 50+ comments

Total points
891

reference only — not used in Hall rules or ranking

Total comments
575

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2014-01-01The Lost Art of C Structure PackingFirst breakout · Best threadTsiolkovsky335143
2015-02-26The Lost Art of C Structure PackingAndreyKarpov11
2015-05-09The Lost Art of C Structure Packingdjulius134
2016-04-27The Lost Art of C Structure Packingetrevino30
2016-06-09The Lost Art of C Structure Packingjohlo40
2016-08-05The Lost Art of C Structure Packing (2014)Hall inductionbramv117112
2017-11-04The Lost Art of C Structure Packinguyoakaoma12349
2019-04-07The Lost Art of Structure Packinggeezerjay10
2019-07-06The Lost Art of Structure Packingpksadiq20
2020-02-25The Lost Art of Structure Packingstargrave10
2020-04-27The Lost Art of Structure Packing (2018)theastrowolfe112112
2022-01-10The Lost Art of Structure Packing (2020)rdpintqogeogsaa21
2022-02-25The Lost Art of Structure Packingibobev60
2022-04-27The Lost Art of C Structure Packing (2014)Latest 20+ point returnisaacimagine159153
2026-01-18The Lost Art of Structure Packingtosh80
2026-01-20The Lost Art of Structure Packingtosh20
2026-04-25The Lost Art of Structure Packingtosh20