Hacker News new | ask | show | jobs
by masklinn 72 days ago
You also need to own the buffer otherwise you’re corrupting someone else’s data, or straight up segfaulting.
1 comments

As long as you clearly document that the incoming data is going to be modified, it's not a problem. And in a lot of cases, the data either comes from the network or is read from the file - so the buffer is going to be discarded at the end anyway... why not reuse it?

And yes, today it would be easier to make a copy of the data... but remember we are talking about 90's, where RAM is measured in megabytes and your L1 cache may be only 8KB or so.