3 ms·
malloc() and free() are a far better API than one that requires unwrapping and casting pointers every time you use them, and - despite trying to keep metadata w
by torstenvl 4y ago
malloc() and free() are a far better API than one that requires unwrapping and casting pointers every time you use them, and - despite trying to keep metadata with the pointer - still requires you to separately track metadata!
Also, throwing C++ code in when he's showing C is wrong on so many levels.
(I just remembered a similar discussion by Richard Heathfield in C Unleashed. I looked it up and it's on pages 285-286. He sets out to improve upon the design of realloc(). He concludes "that whoever designed realloc did know what they were doing, after all. There's a lesson there somewhere for overzealous wheel inventors.")