Re: [Tuxpaint-devel] Execution terminating
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
|
From: Albert C. <aca...@gm...> - 2008-06-01 21:08:03
|
On Sun, Jun 1, 2008 at 8:49 AM, foo-script <foo...@o2...> wrote: > How to let TuxPaint know, that something went wrong, > eg. memory couldn't be allocated? You don't. You should detect errors if you can handle them. If there is nothing useful to do when an error happens, then there is no reason to check for it. Memory allocation has an additional problem. Most OSes do not return NULL, because they assume that memory will become available. The memory is not fully allocated until it is written to. This allows the OS to give out more memory than it has available. OSes do this because most allocations are never fully used. > I suppose that using perror, just like usually > man does, is not allowed. It's discouraged. Ignoring the error is often better. If ignoring the error would cause a crash or worse, then go ahead and use perror. You can print to stderr. This should not happen under normal conditions. Regular users are unlikely to see the messages, and the printing will make Tux Paint run slower. |