mem said:
If exception disabled, how to handle the situations of "out-of-memory" when
creating objects with "new"?
You could try catching exceptions of type "std::bad_alloc", but that might
not work because by the time you're out of memory, there's so little resources
left that your OS will probably NOT be able to even run your exception-
handling routine.
I few days ago I tried writing a handler for std::bad_alloc in a Windows
program, and tested it by attempting to load 5,000,000,000 instances of
a struct into a map, but the handler never ran. Not enough memory left!
The system crashed, instead.
I was amused at what Bjarne Stroustrup says in "The C++ Programming
Language" about memory exhaustion: he says that the best way to "handle"
that situation is to make sure it never occurs in the first place! Ie, buy more
RAM or use less memory. (And don't leak.)
What is "Boost" about which people have been talking often? What platforms
does it support? Thanks!
Dunno. Try Googling it.
--
Cheers,
Robbie Hatley
Tustin, CA, USA
email: lonewolfintj at pacbell dot net
(Include "[ciao]" in subject to bypass spam filters.)
web: home dot pacbell dot net slant earnur slant