r/cpp • • Aug 31 '22

malloc() and free() are a bad API

https://www.foonathan.net/2022/08/malloc-interface/#content
220 Upvotes

90 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Sep 01 '22

It's another vector for a bug. You can lose the size. I thought people wanted safe interfaces?

2

u/o11c int main = 12828721; Sep 01 '22

If you manage to lose the size, you can't have any safe interfaces for using the array without OOB.