Re: Why leave the error handling to the caller?
- From: Flash Gordon <spam@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 19 Jun 2007 21:35:38 +0100
Malcolm McLean wrote, On 19/06/07 20:37:
"Flash Gordon" <spam@xxxxxxxxxxxxxxxxxx> wrote in message news:4bogk4xq23.ln2@xxxxxxxxxxxxxxxxxxxxxxxxxxMalcolm McLean wrote, On 17/06/07 22:40:But what if you don't have a program at all because with the 33:67 payload to malloc recovery ratio, it costs too much to write?
"Eric Sosman" <esosman@xxxxxxxxxxxxxxxxxxx> wrote in message news:HYqdneY53-HiBOjbnZ2dnUVZ_jGdnZ2d@xxxxxxxxxxxxxxMalcolm McLean wrote:> [code snipped; see up-thread]
"Richard Heathfield" <rjh@xxxxxxxxxxxxxxx> wrote in message news:7oCdnWXORp3b-ujbnZ2dnUVZ8szinZ2d@xxxxxxxxxMalcolm McLean said:The problem is that the code is disproprtionate. [...]
<snip>
There quite a strong case for a safemalloc() library function that
does terminate with an error message on fail.
No, there isn't. Library routines have no business deciding to terminate
the program.
<snip>
Should fprintf() halt the program on an I/O error?The Turing machine has run out of tape. That's a different kind of problem to the others you have described.
Should fopen() halt the program if unable to open the file?
Should strtod() halt the program on a malformed input?
Then why should malloc() halt the program on a whim?
It is a recoverable error in many situations just as all the others are. For example, when stressing my company notebook several times I've had VMware tell me it was out of memory giving the option to retry. I closed down some other stuff, told it to retry, and continued with my work. Far better than your approach of having it die on me.
That's rubbish according to your own attempt at showing how bad the ratio is.
Sometimes it's an issue, sometimes not. If you are writing Microsoft's next OS you have practially infinite resources.
That's rubbish because the above situation is on a modern (only a couple of months old) medium to high spec notebook.
On my previous company notebook which was high spec at the time I would also run out of resources.
I've seen servers run out of resources, including high spec ones.
> If you're knocking up a
game on a tight budget, it is no good missing Christmas. If it crashes out one every hundred hours of gameplay, that's not ideal but it isn't the end of the world either. If it is two months late it might be canned, then you get zero royalties, and no-one will ever play it.
If it crashes too often because it is badly written no one will buy it. In one extreme case a game got canned because after it was produced they found it contained a virus, so there they lost a lot more money. I'm sure others have failed to make it to market, or failed to have significant sales, due to too many bugs.
--
Flash Gordon
.
- References:
- Why leave the error handling to the caller?
- From: Chad
- Re: Why leave the error handling to the caller?
- From: Malcolm McLean
- Re: Why leave the error handling to the caller?
- From: Richard Heathfield
- Re: Why leave the error handling to the caller?
- From: Malcolm McLean
- Re: Why leave the error handling to the caller?
- From: Eric Sosman
- Re: Why leave the error handling to the caller?
- From: Malcolm McLean
- Re: Why leave the error handling to the caller?
- From: Flash Gordon
- Re: Why leave the error handling to the caller?
- From: Malcolm McLean
- Why leave the error handling to the caller?
- Prev by Date: Re: call of variadic function
- Next by Date: Re: Listen a socket for client request for 10 seconds
- Previous by thread: Re: Why leave the error handling to the caller?
- Next by thread: Re: Why leave the error handling to the caller?
- Index(es):
Relevant Pages
|
|