Re: If malloc fails
From: roman ziak (news1_at_MYLASTNAME.com)
Date: 07/20/04
- Next message: Gerry Thomas: "Re: Newbie question: Why Fortran?"
- Previous message: Peter Nilsson: "Re: help with compiler directives"
- In reply to: Christian Bau: "Re: If malloc fails"
- Next in thread: kal: "Re: If malloc fails"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: Gerry Thomas: "Re: Newbie question: Why Fortran?"
- Previous message: Peter Nilsson: "Re: help with compiler directives"
- In reply to: Christian Bau: "Re: If malloc fails"
- Next in thread: kal: "Re: If malloc fails"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|