K
Koen
Hi!
What is the method you use to handle memory allocation failure in C++
using the "new" operator?
I used to only check if a NULL pointer is returned after the "new" call,
but that's probably only working in MSVC++.
I also read about the "bad_alloc" exception, but that doesn't seem to be
thrown by MSVC++.
Now, one could of course say "don't use MSVC++", but I'd rather like to
hear a good solution for being able to handle memory allocation failure
in a cross-compiler way (we're using MSVC++ on windows and gcc on
linux). Any ideas anyone?
Is installing a new handler the only way to be sure?
Koen
What is the method you use to handle memory allocation failure in C++
using the "new" operator?
I used to only check if a NULL pointer is returned after the "new" call,
but that's probably only working in MSVC++.
I also read about the "bad_alloc" exception, but that doesn't seem to be
thrown by MSVC++.
Now, one could of course say "don't use MSVC++", but I'd rather like to
hear a good solution for being able to handle memory allocation failure
in a cross-compiler way (we're using MSVC++ on windows and gcc on
linux). Any ideas anyone?
Is installing a new handler the only way to be sure?
Koen