News for hackers. Stuff that matters.
Re:Show HN by kevin_thibedeau on Saturday December 03, 2022 @12:35PM (#33845287)
> No other type in C behaves like this,

Malloc does this.

Re:Show HN by lifthrasiir on Saturday December 03, 2022 @12:49PM (#33845467)
Malloc is not a type. If you meant to say realloc, a good point and it's indeed a bad interface for the exact reason but still it's not a type.
Re:Show HN by Karellen on Saturday December 03, 2022 @01:49PM (#33846137)
I believe malloc() was intended, as a number of old-school UNIX implementations of malloc() put the size of the allocation (and possibly other bookkeeping info?) "in front of" the pointer returned, in a similar way to how sds stores the size of its buffer.