News for hackers. Stuff that matters.
Re:What If I Don't Actually Like My Users? (2008) by userbinator on Friday June 03, 2016 @12:37AM (#11828334)
To be fair, without knowing what that API does, I could see a situation where it itself doesn't know how long the data would be. Parsing free-form char-terminated data, especially over the network, is one example that comes to mind, and another is decompressing compressed data in a self-delimited stream; in general, data whose length cannot be determined apriori. Furthermore, the API probably doesn't want to allocate and buffer the data itself since it could be very long, nor does it want to impose a fixed limit since the application should decide that.
Re:What If I Don't Actually Like My Users? (2008) by stcredzero on Friday June 03, 2016 @12:42PM (#11831395)
To be fair, without knowing what that API does, I could see a situation where it itself doesn't know how long the data would be.

This was to get a message out of the API. At the point one is making the call, it does know how long the message is. (Having already gotten a callback.) It looks like the author forgot to write the function that would return the length, then improvised.

Furthermore, the API probably doesn't want to allocate and buffer the data itself since it could be very long, nor does it want to impose a fixed limit since the application should decide that.

This was probably the case.