Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Once upon a time, memory allocators made sense. Parent comment
void *my_realloc(void *ptr, size_t size) { return size ? realloc(ptr, size) : (free(ptr), 0); }
> If ptr is a null pointer, the realloc function behaves like the malloc function for the specified size.
Also, free(0) is well-defined. From n1548 7.22.3.3 para 2:
> If ptr is a null pointer, no action occurs.
There are no comments on this comment yet.
> If ptr is a null pointer, the realloc function behaves like the malloc function for the specified size.
Also, free(0) is well-defined. From n1548 7.22.3.3 para 2:
> If ptr is a null pointer, no action occurs.