Subject: Re: Abi string class
From: Mike Nordell (firstname.lastname@example.org)
Date: Thu Feb 01 2001 - 22:57:44 CST
Sam TH wrote:
> So, what happens if you get an OOM error is that it fails silently,
> and you keep the old value?
Currently, yes. Nothing is yet carved in stone.
> This seems like a really bad idea. How can we detect errors?
Let me answer that with another question. What happens if you write
pNewScheme = new XAP_PrefsScheme(this, NULL);
and get OOM? Answer: AbiWord dies. A C++ exception of type bad_alloc is
thrown from the new_handler function. Since we have no exception handler it
ends up in terminate_handler which calls abort(). Seen in this light,
perhaps I should use new instead of malloc and follow the lead. At least it
would terminate the application rather than producing boguous result.
For your question "How can we detect [OOM] errors?".
The short answer is: with the current constraints we can't.
The long answer is: By using our different compilers different runtime
library implementation functions (meaning: since MSVC is non-conforming we'd
have to write non-C++ code to make it) we can try to make an emergency save.
I trust the emergency save functionality don't use any memory functions.
But, this would mean we *have* to use exception, and since we can't write
any exception- handling or throwing code this is currently a catch 22.
This archive was generated by hypermail 2b25 : Thu Feb 01 2001 - 22:56:25 CST