kk****@yahoo.com wrote:
I'm looking for opinions for or against catching std::bad_alloc when I
use the "new" operator. I searched through this newsgroup and the
Internet, and I don't see clear opinions either way. Note that I am
using gc++ version 3.2 on a unix platform, so I'm not concerned with
any points unique to VC++.
Depends if you want to handle memory errors. Generally it's a good
idea, but often you can't do very much but close the program. It's
always nice to tell the user that they've run out of memory before
crashing hard :).
It's possible you can dump some other data, to free up memory and
continue. It's your call.
Ben Pope
--
I'm not just a number. To many, I'm known as a string...