Re: Why leave the error handling to the caller?



In article <467a4fd5.265449486@xxxxxxxxxxxxxx>,
Richard Bos <rlb@xxxxxxxxxxxxxxxxxxxxxx> wrote:
dj3vande@xxxxxxxxxxxxxxxxxxx (Dave Vandervies) wrote:

From the OpenSSH 4.6 source code:
[snip xmalloc code that terminates program on allocation failure]

I wouldn't exactly call SSH "not real world". I think you'd have trouble
arguing that the people who wrote this code didn't carefully consider
what was and wasn't appropriate behavior on memory allocation failure
before they wrote it this way, even if you disagree with their conclusion.

That's as may be, but I do hope that that code didn't find its way into
the SHTTP parts of, e.g., Firefox.

I expect not; I believe OpenSSH uses OpenSSL for its encryption, and
other code that needs encryption would be more likely to build on top
of OpenSSL (with, one hopes, more reusable-library-appropriate error
handling) than OpenSSH.

Crash&dump is all very well for a
small command line tool, but if an application can hold any serious
amount of data in memory, it's an evil thing to do to your users.

You're thinking too small. Firefox likes to bring the whole windowing
system down on resource allocation failures. (Though I haven't used
recent versions for long-running sessions, so there's a chance they
might have finally fixed that.)


dave

--
Dave Vandervies dj3vande@xxxxxxxxxxxxxxxxxxx
I presume the difference is that Laurier's off-campus environment includes the
University of Waterloo, whereas the best we can offer by way of off-campus
environment is, well, Laurier. . . . --Chris Redmond in uw.general
.



Relevant Pages

  • Re: xmalloc string functions
    ... applications doing complex tasks for which memory allocation failure is only ... applications which do try to handle malloc failure of course). ...
    (comp.lang.c)
  • Re: vector/memory
    ... > Whats the way to detect allocation failure in vector? ... > insight on it ... Whenever you do an operation that could do a memory allocation (eg, ...
    (microsoft.public.vc.stl)