Re: if allocate() returned -1 on failure...
- Posted by petelomax 1 week ago
- 225 views
Honestly, I don't understand what you mean.
If you don't use allocate() a ton of times, you're probably not in a position to answer the question anyway. Don't worry, it's probably a bit of a niche question.
Currently, allocate() returns 0 when it fails, either because you've already allocated so much memory there is no more to give, or you've asked it for a silly value, like -1 (aka MAXINT).
Many programs won't bother to check, and just crash as soon as they try to peek() or poke() it. Most programs never get anywhere near hitting the problem.
I'm thinking of changing it to return -1 on failure, the question is: of the (few?) programs that do actually check it, how many will be badly affected?
If I make that change, there's a trivial fix once you know what you have to change, but how painful might it be before you make that change?
In other words, are there any significant objections to me making that change?

