HN Hall of Fame Weekly email

Why does calloc exist?

vorpus.org Essays & writing Essays & articles Software engineering Candidate
Screenshot of vorpus.org captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 4 calendar years, with breakout response in 2 of them.

submissions
4
submitters
4
observed span
2016–2022
peak thread · 163 comments
553 pts
latest 20+ return · 2022-11-13
303 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

buf = calloc(huge, huge); if (errno) perror("calloc failed"); printf("calloc(huge, huge) returned: %p\n", buf); free(buf); This has a flaw. errno doesn't magically get reset to zero. You should check the return value of calloc, then use errno. Checking if(errno) is not the right way to determine if there was an error.

_RPM·553-point thread·

It may be true today that calloc checks for multiplication overflow and doesn't zero memory if it doesn't need to, that's modern revisionism. Historically, calloc did not do either of those things. eg, from the 4.4 BSD, circa 1993: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src... void * calloc(num, size) size_t num; register size_t size; { register void *p; size *= num; if (p = malloc(size)) bzero(p, size); return(p); }

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
2

100+ points or 50+ comments

Total points
862

reference only — not used in Hall rules or ranking

Total comments
295

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2016-12-05Why does calloc exist?First breakout · Best threadwyldfire553132
2018-06-11Why does calloc exist?jorangreef20
2019-07-20Why does calloc exist? (2016)rspivak40
2022-11-13Why does calloc exist? (2016)Latest 20+ point returngoranmoomin303163