Re: If malloc fails

From: roman ziak (news1_at_MYLASTNAME.com)
Date: 07/20/04


Date: Mon, 19 Jul 2004 21:21:36 -0400


"Christian Bau" <christian.bau@cbau.freeserve.co.uk> wrote in message
news:christian.bau-2F56C6.22283319072004@slb-newsm1.svr.pol.co.uk...
> In article <slrncfnh80.7rf.sujith@localhost.localdomain>,
> "H.A. Sujith" <sujith@localhost.localdomain> wrote:
>
> > If malloc fails what should I do?
> >
> > 1. Exit imediately.
> > 2. Print an error message (or put a log entry) and exit.
> > 3. Print an error message (or put a log entry) and continue
> > execution (after possibly recovering from the error).
> >
> > Printing an error message might be difficult in a graphical environment.
>
> You look at it from the programmer's point of view. You should look at
> it from the user's point of view. What are the consequences for the user
> of your software of your action? What can you do or what do you have to
> do to improve these consequences?
>
> If I spent twelve hours editing a document, choose "Save" from a menu,
> and the program runs out of memory just at this point and exits (after
> printing an error message or not) without saving twelve hours of my
> work, then the programmer responsible deserves to be shot.

Totally agree.

If there is a chance somebody wasted a lot of time with the program,
exit() is not an option.



Relevant Pages

  • Re: If malloc fails
    ... > Printing an error message might be difficult in a graphical environment. ... then the programmer responsible deserves to be shot. ...
    (comp.lang.c)
  • Re: Why Am I getting Cant Print Because of Error Message?
    ... > Did you try printing another document? ... > | tonight where they had a survey for customers to fill out. ... > | phone tech support and chat support where you can just cut right to the ... > | of numbers you sometimes get with an error message. ...
    (microsoft.public.publisher)
  • Re: Printing Area Too Small
    ... Default output will go to the active window, and since that is a very ... When I call it from an external form I do not get the "Printing Area Too ... for using inputbox. ... that is what could be generating the error message. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Why Am I getting Cant Print Because of Error Message?
    ... Did you try printing another document? ... | I can still print my other greeting cards but on that specific one (or any ... | phone tech support and chat support where you can just cut right to the ... | of numbers you sometimes get with an error message. ...
    (microsoft.public.publisher)
  • Re: syntax of INS error installing printer
    ... Cari Windows Client - Printing & Imaging ... is not attached to the computer until the install program requests that ... I got the error message the syntax of the INS ...
    (microsoft.public.windowsxp.print_fax)