Submission timeline
2007–2026One 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 orderbuf = 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.
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
- Total points
- 862
- Total comments
- 295
100+ points or 50+ comments
reference only — not used in Hall rules or ranking
reference only — not used in Hall rules or ranking
Every submission
| Date | Title as submitted | By | Points | Comments |
|---|---|---|---|---|
| 2016-12-05 | Why does calloc exist?First breakout · Best thread | wyldfire | 553 | 132 |
| 2018-06-11 | Why does calloc exist? | jorangreef | 2 | 0 |
| 2019-07-20 | Why does calloc exist? (2016) | rspivak | 4 | 0 |
| 2022-11-13 | Why does calloc exist? (2016)Latest 20+ point return | goranmoomin | 303 | 163 |
